Skip to content

Instantly share code, notes, and snippets.

🏳️‍🌈
Breaking things

Noel Cower nilium

🏳️‍🌈
Breaking things
Block or report user

Report or block nilium

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nilium
nilium / concurrency.go
Last active May 3, 2016 — forked from kevinburke/concurrency.go
Helping kevinburke
View concurrency.go
package main
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
View max.scala
def max(list: List[Int]): Int = list match {
case Nil => throw new NoSuchElementException
case List(x) => x
case x +: tail =>
val rhs = max(tail)
if (x >= rhs) x else rhs
}
View valid-ipv4.rb
module Valid
OCTET_RANGE = (0 .. 255)
def self.ipv4?(address)
octets = address.split '.'
octets.length == 4 && octets.all? { |octet|
octet_i = octet.to_i
(0..255).cover?(octet_i) && octet_i.to_s(10) == octet
}
end
View gifkiller.jquery.js
javascript:$('img').filter(function() { if( this.src.substr(-3).toUpperCase() === 'GIF' ) return this; }).replaceWith('<img src="http://i.imgur.com/vMgrL.png" />');;
@nilium
nilium / rot13.rb
Created Aug 8, 2012 — forked from rlemon/gist:3297381
ROT13 in Ruby
View rot13.rb
['string'].map{|a|a.split('').map{|b|return b if(!/[a-z]/i.match b);c=b[0].ord>=96;k=(b.downcase[0].ord-96+12)%26+1;[k+(c ? 96: 64)].pack 'U*'}.join}.join
View rbtree.ooc
RBNodeColor: enum {
black = 0
red = 1
}
RBNode: class <K, V> {
View compare.ooc
Nut: class {
cracker: Int
init: func(cracker: Int) {
this cracker = cracker
}
bust: func {
cracked *= 5
You can’t perform that action at this time.