Skip to content

Instantly share code, notes, and snippets.

View supernullset's full-sized avatar

Sean Williamson supernullset

View GitHub Profile
var repo_prefixes = []string{"git://","git@","http://","https://","ssh://"}
func (r *Repo) isGitImproved() bool {
for _,prefix := range repo_prefixes {
if strings.HasPrefix(r.Path, prefix) { return true }
}
return false
}
# This is ripe for some refactoring, but I think it shows an okay
# implementation of the factory pattern
class Animal(object):
sound = ""
description = ""
def describe(self):
return self.description
cat *.json |\
jq 'map(select(.from.name=="Nate Klaiber"))' |\
jq '.[].message' |\
grep -v 'jq' |\
sed -e 's/\([[:punct:]]\)//g' |\
grep -v '^$' |\
tr '\n' ' ' |\
tr ' ' '\n' |\
tr '[:upper:]' '[:lower:]' |\
sort |\
sendKeyPress: function() {
console.log('sendKeyPress');
var $editor = $(this.get('editor').getDocument()).find('body');
var keyEvent = $.Event( "keypress", { keyCode: 69, which: 69, charCode: 69 });
$editor.focus();
$editor.trigger(keyEvent);
},
{
"meta": {
"limit": 10,
"offset": 0,
"page_count": 10,
"data_type": "collection",
"links": {
"last": "http://localhost:3000/collections?limit=10&offset=10",
"root": "http://localhost:3000/",
"self": "http://localhost:3000\n/collections?limit=10&offset=0",
── blanket#1.1.5 (latest is 1.1.7)
├── bourbon#4.2.1 (latest is 4.2.3)
├─┬ dinosheets#0.0.1 (latest is 0.1.0)
│ └── loader.js#3.2.0 (latest is 3.2.1)
├─┬ ember#1.12.1 (latest is 1.13.0-beta.2)
│ └── jquery#2.1.3 (2.1.4 available)
├─┬ ember-cli-moment-shim#0.1.0
│ └── moment#2.10.3
├─┬ ember-cli-shims#0.0.3
│ └── ember#1.12.1 (1.13.0-beta.2 available)
module ZeroOneOne (main, parMain) where
import Lib as L
import Data.List (transpose)
import Control.Parallel.Strategies
{-
Problem 11:
In the 2020 grid below, four numbers along a diagonal line have been marked in red.
@supernullset
supernullset / Bieberlicious
Created August 24, 2012 00:35
Wrapper to connect to my riak instance
{-# LANGUAGE DeriveGeneric, OverloadedStrings #-}
import Network.Riak
import Network.Riak.Connection as C
import Network.Socket as S
import System.IO.Unsafe (unsafePerformIO)
import Data.ByteString.Lazy.Char8 as BSL
import Network.Riak.JSON.Resolvable as RR
import Network.Riak.Types
import Data.Aeson
@supernullset
supernullset / probe.rb
Created September 6, 2012 05:38
Weird net/ftp behavior
require 'net/ftp'
ftp_root = "tgftp.nws.noaa.gov"
# Im running conn_test with arbitrary values for n
def conn_test(root, n)
(1..n).to_a.each do |i|
ftp = Net::FTP.new root
begin
ftp.passive
@supernullset
supernullset / levenshtein_ranking.coffee
Created October 17, 2012 19:13
Fuzzy string comparison/sort in javascript
curry = (fn)->
slice = Array.prototype.slice
args = slice.apply arguments, [1]
return ->
fn.apply null, args.concat(slice.apply arguments)
levenshteinD = (s,t) ->
if !s.length then return t.length
if !t.length then return s.length