Skip to content

Instantly share code, notes, and snippets.

View coleww's full-sized avatar

Cole Willsea coleww

  • (=^.^=)
  • Berkeley, CA
View GitHub Profile
@edalorzo
edalorzo / brainfuck.js
Created December 12, 2013 22:26
Branfuck Interpreter
function brainfuck(code,input){
var pc = 0;
var sysout = [];
var sysin = input.split('').reverse();
var ptr = 0;
var data = [0];
var size = code.length;
var program = code.split('')
var loops = [];
export RUBY_HEAP_MIN_SLOTS=1250000
export RUBY_HEAP_SLOTS_INCREMENT=100000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=30000000
export RUBY_HEAP_FREE_MIN=12500
@john2x
john2x / 00_destructuring.md
Last active June 6, 2024 13:40
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@coleww
coleww / gist:bba339511ee1ad484e79
Created July 28, 2014 03:36
Infinite endorsements
window.setInterval(function(){
document.getElementsByClassName('action-endorse')[~~(Math.random() * 4)].click()
}, 5000);
//paste this into javascript console when the 4 tile DOES __ KNOW ABOUT __? ENDORSE! dialog appears on linked in.
//they don't seem to be grepping for robots so no need to randomize the interval
//will run until they run out of recent recommendations. click around a bit and it will come up again.
@seejohnrun
seejohnrun / example.rb
Last active August 29, 2015 14:05
satirical ruby
class String
def |(other)
other.call(*self)
end
def >(other)
File.write(other, *self)
0
end
end
var stream = tmpStream(function(filename, stat, cb) {
// do stuff
// when done call cb which will unlink filename
// plus emit 'finish' on stream (or 'error' if called with an error)
})
stream.write('hello world')
stream.end()
stream.on('finish', function() {
Turning The Design Clock Back
Object-oriented design principles haven't had the effect we hoped for. The
SOLID principles are excellent design guidelines, but experience shows that
programmers find them difficult to follow. What do we do about this?
Surprisingly, the Structured Design literature of forty years ago contains
compelling solutions to many current design problems. They're simple and easy
to understand, but were lost in the noise as OO rose to popularity. We'll
reinterpret these simple design ideas in a modern context, finding that many of
our most promising new design ideas resemble them. Rapid web application
@coleww
coleww / gist:11963433bd480c795e33
Last active August 29, 2015 14:05 — forked from garybernhardt/gist:57047446ec80c0913166
Forge Driven Development
Turning The Metal Clock Back
Forge-driven metal principles haven't had the effect we hoped for. The
NORCAL principles are excellent metal guidelines, but experience shows that
metallurgists find them difficult to follow. What do we do about this?
Surprisingly, the Structured metal literature of two months ago contains
compelling solutions to many current metal problems. They're simple and easy
to understand, but were lost in the noise as TDD rose to popularity. We'll
reinterpret these simple metal ideas in a modern context, finding that many of
our most promising new metal ideas resemble them. Rapid reverse-forge driven
@coleww
coleww / TDD IS ALIVE
Created August 29, 2014 12:48
not sure i understand "Node"...
var test = require('tap').test;
var tests = require('./tests.js');
tests(test);
@pjkelly
pjkelly / install-phantomjs.md
Last active January 27, 2020 21:30
Installing PhantomJS

Installing PhantomJS via Homebrew and fixing Ruby if it breaks

PhantomJS is an awesome tool for doing automated, full-stack acceptance tests in a headless browser. It's a great alternative to capybara-webkit because it doesn't depend on QT or xvfb, and it's way better than Selenium in most cases because it's faster (you don't need to open Firefox to run your tests).

Unfortunately, installing PhantomJS via Homebrew can wreak havoc on your Rubies if you're using rbenv. These are the steps that worked for me in fixing my Ruby installations.

# Update Homebrew
brew update
# Install PhantomJS