Skip to content

Instantly share code, notes, and snippets.

Ryan Cromwell cromwellryan

Block or report user

Report or block cromwellryan

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
View sexybkg.js
var bgcolorlist = ["#DFDFFF", "#FFFFBF", "#80FF80", "#EAEAFF", "#C9FFA8", "#F7F7F7", "#FFFFFF", "#DDDD00"];
document.body.style.background=bgcolorlist[Math.floor(Math.random()*bgcolorlist.length)];
View config.ru
# hello_world.rb
require 'rack'
require 'rack/server'
class HelloWorldApp
def self.call(env)
[ 200, {}, ['Hello World'] ]
end
end
@cromwellryan
cromwellryan / 0_reuse_code.js
Created Feb 14, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View README.md
View todo.sh
# Step 1: Download this zip: https://github.com/daytoncleancoders/projects/raw/master/commandline/command-line-kata.zip
# (mac/nix hint: curl, wget)
# (windows hint: net.webclient)
if [ ! -d "site" ]
then
curl -O https://raw.github.com/daytoncleancoders/projects/master/commandline/command-line-kata.zip
# Step 2: Extract the zip
# (hint: tar)
View yield.rb
def blah
yield 1
p "2 coming"
yield 2
end
blah { |x| p x }
View a.rb
def pmap(enum)
return to_enum(:pmap, enum) unless block_given?
enum.each_with_index.map { |e,i| Thread.new { sleep(Random.rand); p e; yield ({index: i, value:e }) } }.map(&:value)
end
p to_enum(:pmap, 1..10).sort_by { |hash| hash[:index] }.map { |hash| hash[:value] }
#p pmap(1..10) { |x| x }
View tc_dice.rb
require_relative 'dice'
require 'minitest/spec'
require 'minitest/autorun'
describe Dice do
before do
@new_roll = Dice.new
end
describe "rolling 5 dice" do
@cromwellryan
cromwellryan / warrior.js
Last active Aug 29, 2015
DCC 3.18.2014
View warrior.js
jsWarrior.turn = function(warrior) {
enhance(warrior);
actions = [ attack_move, heal_move, walk_move ];
available_actions = actions.filter( function(action) { return action.can(warrior); } );
available_actions[0].act(warrior);
warrior.last_health = warrior.getHealth();
View keybase.md

Keybase proof

I hereby claim:

  • I am cromwellryan on github.
  • I am cromwellryan (https://keybase.io/cromwellryan) on keybase.
  • I have a public key whose fingerprint is E31F A201 E2FA 4C3F A9DC 282F 544D 252A 05BE B4C3

To claim this, I am signing this object:

You can’t perform that action at this time.