• Hello World

    mparke        
    0 Likes0 Commentsjavascript

    <script>alert('hello world');</script>
  • One liner to print all of unicode

    abemassry        
    0 Likes0 Commentssh

    for i in `bc <<< "obase = 16 ; $(seq 0 65536)" | tr '\n' ' '`; do printf "$i:"; printf "\u$i"; printf '\n'; done | rs -e | less
  • Function Captchas

    Dorthu        
    0 Likes0 Commentspython

    >>> def captcha(challenge=None, answer=None):
    ...   def _dec(f):
    ...     @wraps(f)
    ...     def _inner(*args, **kwargs):
    ...       if not challenge in kwargs or not kwargs[challenge] == answer:
    ...         raise ValueError('captcha failed!')
    ...       del kwargs[challenge]
    ...       return f(*args, **kwargs)
    ...     return _inner
    ...   return _dec
    ...
    >>> @captcha(challenge='two_plus_three', answer=5)
    ... def foo(bar):
    ...   print("bar is {}".format(bar))
    ...
    >>> foo('test')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<stdin>", line 6, in _inner
    ValueError: captcha failed!
    >>> foo('test', two_plus_three=5)
    bar is test
  • Distilled Greatness

    Dorthu        
    0 Likes0 Commentsperl

    print map { tr/at/pl/r } grep { (ord) % 4 < 3 } sort split //, 'great';
  • Holy hell

    Akiiino        
    1 Likes0 Commentspython

    x = train_data[train_data[:,1].argsort()][(lambda label_count: list(itertools.chain.from_iterable(range(i, i+50) for i in [0]+label_count[:-1]))+list(itertools.chain.from_iterable(range(i+50, j) for i,j in zip([0]+label_count, label_count))))(list(itertools.accumulate(labels.count(a) for a in range(500))))]
  • Functional Ruby

    jaturken        
    0 Likes0 Commentsruby

    def push_page_urls_to_queue(url, doc)
      doc.xpath('//a/@href').
        map{ |link| link.text.strip }.
          select{ |u| belongs_to_domain?(u, url) }.
            map { |u| full_url(u, url) }.
              select{ |u| !already_crawled?(u) }.
                map { |u| queue << { url: u, priority: url_priority(u) } }
    end
  • Smile

    abemassry        
    0 Likes0 Commentsjson

    {"Hi": "😀"}
  • Untitled

    b-oern        
    0 Likes0 Commentsjavascript

    {
    hideMarker: bool default false,
    items: [
         {
              type: path,
              width: float default 4,
              a int default 50,
              r int default 10,
              g int default 50,
              b int default 250,
              points: [[6,21], [6,52]]
         },
         {
              type: circle,
              radius: 1000,
              a int default 50,
              r int default 10,
              g int default 50,
              b int default 250,
              lat: 51,
              lng: 6
         },
         {
              type: polygon,
              points: [[6,51], [6,52]],
              strokeWidth: float default 4,
              a int default 50,
              r int default 10,
              g int default 50,
              b int default 250
         },
         {
              type: overlay,
              image: "url",
              width: int default 100   // in Metern
              height: int default 170
              lat: 51,
              lng: 6
         }
    ]
    }
    
  • Please stop!

    WhoStoleMyNick        
    0 Likes0 Commentscsharp

    Thread.Sleep(duration); // everytime you write Thread.Sleep this time deducting from your lifetime
  • Untitled

    rorattol        
    0 Likes0 Commentsphp

    <?php
    
    echo "test is over";
    
    ?>