Skip to content

Instantly share code, notes, and snippets.

View danivovich's full-sized avatar

Dan Ivovich danivovich

View GitHub Profile
@jszmajda
jszmajda / game_of_life.js
Created September 18, 2011 16:41
Game of Life in Backbone.js
var stepTime = 1;
var col = undefined;
var Cell = Backbone.Model.extend({
x: -1,
y: -1,
alive: false,
nextAlive: false,
initialize: function() {
@jszmajda
jszmajda / Readme.md
Created September 18, 2011 20:22
Game of Life in Erlang

Conway's Game of Life in Erlang, in 2 hours, with 0 Erlang experience, in 20 lines of code.

1337 h4x0rs:

  • @jszmajda
  • @ngauthier
  • @ericoestrich
  • @danivovich
  • @kafuchau
@thijsc
thijsc / gist:1391107
Created November 24, 2011 11:08
Select item from chosen js select with Capybara and Selenium
def select_from_chosen(item_text, options)
field = find_field(options[:from])
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()")
page.execute_script("$('##{field[:id]}').val('#{option_value}')")
end
@royratcliffe
royratcliffe / ubuntu12.04-ruby1.9.1.erb
Created April 20, 2012 12:26
Chef bootstrap for Ubuntu Precise Pangolin (12.04) using Ruby 1.9
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
(
cat <<'EOP'
gem: --bindir=/usr/bin --no-ri --no-rdoc
EOP
) > /tmp/gemrc
awk NF /tmp/gemrc > /etc/gemrc
rm /tmp/gemrc
@samwgoldman
samwgoldman / facebook_test_user.rb
Created June 20, 2012 13:38
Easily create test users for facebook
require "httparty"
class FacebookTestUser
include HTTParty
base_uri "graph.facebook.com:443"
attr_reader :email, :password
def initialize(options)
@email = options["email"]
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jsteiner
jsteiner / database_cleaner.rb
Created January 10, 2014 20:31
Database Cleaner
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
@genegoykhman
genegoykhman / Blitz Talk.scpt
Created June 24, 2016 01:29
Auto-advance a Deckset presentation 15-seconds per slide
tell application "Deckset"
set doc to first document
set ind to 0
set slideIndex of doc to ind
set delaySeconds to 15
--set question to display dialog "Start presentation?" buttons {"OK", "Cancel"} default button 1
--set answer to button returned of question
--if answer is equal to "OK" then
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active August 16, 2024 13:39
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r