This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns primeFactors) | |
(defn square [n] (* n n)) | |
(defn divisible-by? [n candidate] | |
(= 0 (rem n candidate))) | |
(defn of [n] | |
(loop [factors [] n n candidate 2] | |
(cond |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "date" | |
require "time" | |
# converts base10 integers into NewBase60 | |
def num_to_sxg(num=nil) | |
sxg = "" | |
vocabulary = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ_abcdefghijkmnopqrstuvwxyz" | |
return 0 if num.nil? || num.zero? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--type-add=ruby=.haml,.rake,.feature | |
--type-add=objc=.pch | |
--type-set=xcode=.pbxproj,.pbxuser,.perspectivev3 | |
--type-set=ragel=.rl | |
--type-set=nib=.xib | |
--type-set=plist=.plist | |
--type-set=tmstuff=.tmproj,.tm_build_errors | |
--type-set=ignorables=.log,.tmp,.pdf | |
--noignorables | |
--nonib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
churn number and file name | |
git log --all -M -C --name-only | grep -E '^(app|lib)/' | sort | uniq -c | sort | awk 'BEGIN {print "count,file"} {print $1 "," $2}' | |
churn number and file name w/ limiting to last n commits | |
git log --all -n 5000 -M -C --name-only | grep -E '^spec/models' | sort | uniq -c | sort | awk 'BEGIN {print "count,file"} {print $1 "," $2}' | |
graph of churn number and frequency | |
git log --all -M -C --name-only | grep -E '^(app|lib)/' | sort | uniq -c | sort | awk '{print $1}' | uniq -c | sort | awk 'BEGIN { print "frequency,churn_count"} { print $1,$2}' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function JsonFile(path) { | |
this.path = path; | |
} | |
JsonFile.prototype = new loadrunner.Dependency; | |
JsonFile.prototype.start = function() { | |
var me = this; | |
$.get(this.path, function(data) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extend jQuery objects with Underscore collection methods. | |
# | |
# Each collection method comes in two flavors: one prefixed | |
# with _, which yields a bare DOM element, and one prefixed | |
# with $, which yields a jQuery-wrapped element. | |
# | |
# So if `this` is a jQuery object, instead of: | |
# | |
# _.max @, (el) -> $(el).height() | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ozymandias | |
I met a traveller from an antique land | |
Who said: "Two vast and trunkless legs of stone | |
Stand in the desert. Near them on the sand, | |
Half sunk, a shattered visage lies, whose frown | |
And wrinkled lip and sneer of cold command | |
Tell that its sculptor well those passions read | |
Which yet survive, stamped on these lifeless things, | |
The hand that mocked them and the heart that fed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getDominantColor(aImg) { | |
let canvas = document.createElement("canvas"); | |
canvas.height = aImg.height; | |
canvas.width = aImg.width; | |
let context = canvas.getContext("2d"); | |
context.drawImage(aImg, 0, 0); | |
// keep track of how many times a color appears in the image | |
let colorCount = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# rubycocoa | |
require 'osx/cocoa' | |
include OSX | |
OSX.require_framework 'ScriptingBridge' | |
class GraffleConverter | |
def initialize | |
@graffle = SBApplication.applicationWithBundleIdentifier_("com.omnigroup.OmniGraffle") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To remove a submodule you need to: | |
Delete the relevant line from the .gitmodules file. | |
Delete the relevant section from .git/config. | |
Run git rm --cached path_to_submodule (no trailing slash). | |
Commit and delete the now untracked submodule files. |
OlderNewer