Skip to content

Instantly share code, notes, and snippets.

View eadz's full-sized avatar

Eaden McKee eadz

View GitHub Profile
Let’s say that you have a submodule in your project called ’submodule1′ and it’s in the following path: ‘vendors/submodule1′. In git there are 3 traces of this this submodule:
1) .gitmodules
2) .git/config
3) the submodule entry in the index/commit itself.
To remove the first two, is really simple, you just edit those files and remove the lines that specify the submdoule. In order to delete the third and last trace of the submodule in git, you need to type the following command:
git rm --cached path/to/submodule
Note: Do not put a trailing slash at the end of path. If you put a trailing slash at the end of the command, it will fail.
UPDATE a submodule
require 'spec_helper'
describe Price do
it "formats a price correctly" do
Price.new(1.00).to_s.should == '$1.00'
Price.new(3.4).to_s.should == '$3.40'
Price.new(3000).to_s.should == '$30.00'
Price.new(3001).to_s.should == '$30.01'
Price.new(300000).to_s.should == '$3,000.00'
Price.new(0.1).to_s.should == '$0.10'
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
desc "Link in the production database.yml"
task :after_update_code do
run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml"
run "ln -nfs #{deploy_to}/#{shared_dir}/config/amazon_s3.yml #{release_path}/config/amazon_s3.yml"
end
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Example</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
// http://www.selfcontained.us/2009/09/16/getting-keycode-values-in-javascript/
keycode = {
getKeyCode : function(e) {
@eadz
eadz / bigredbutton.rb
Created September 13, 2011 21:55
big red button
#!/usr/bin/env ruby
#
# AUTHORS
# Eaden McKee <eadz@eadz.co.nz>
# First Big Red Button Version
# Forked from DelcomLightHid https://raw.github.com/puyo/delcom_light_hid
# ( for a different device)
# Originally by
# Ian Leitch <ian@envato.com>, Copyright 2010 Envato
# * Original single light RGY version
@eadz
eadz / time.rb
Created September 27, 2013 07:18
Ruby missing time
» Time.parse("1 Jan 1111") + 1.year
=> 1111-12-25 00:00:00 +1000
» Time.parse("1 Jan 1500") + 1.year
=> 1500-12-23 00:00:00 +1000
» Time.parse("1 Jan 1900") + 1.year
=> 1901-01-01 00:00:00 +1000
@eadz
eadz / gist:10220496
Created April 9, 2014 02:27
slack custom css
/*
User Stylesheet for Slack.
Use with http://www.squarefree.com/userstyles/make-bookmarklet.html
to make a custom css Bookmarket
*/
.light_theme .message {
@eadz
eadz / keybase.md
Last active October 8, 2016 19:09

Keybase proof

I hereby claim:

  • I am eadz on github.
  • I am eadz (https://keybase.io/eadz) on keybase.
  • I have a public key ASB8MgwUsH_RlBmuVFwgEvvyCSZbcAo11tXpd570OIrxfgo

To claim this, I am signing this object:

@eadz
eadz / ruby-redux.rb
Last active October 4, 2022 21:24
Redux in Ruby
# Redux in Ruby
class Store
attr_reader :state
def initialize(initial_state, *reducers)
@reducers = reducers
@state = initial_state || {}
end
@eadz
eadz / to_proc.curry.rb
Created May 21, 2020 22:53
to_proc.curry
changer = "Hello X World".method(:tr).to_proc.curry.call("X")
changer.call("Z") # => Hello Z World
changer.call("Y") # => Hello Y World