1) git-checkout <bad-commit>
... make your changes ...
2) git-commit --amend -v
3) git-rebase --onto HEAD <bad-commit> <checked-out-branch>
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
string = '2+10/5-2' | |
def calculate(string) | |
operators = [:/, :*, :-, :+].reverse | |
res = string | |
operators.each do |op| | |
splits = string.split(op.to_s) | |
if splits.size > 1 | |
puts '-------' |
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 File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
# Require the gems listed in Gemfile, including any gems | |
# you've limited to :test, :development, or :production. | |
Bundler.require(*Rails.groups) | |
# Load configs from config/application.yml | |
# config/application.yml | |
# default: &default |
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
Show hidden characters
[ | |
{ "keys": ["super+shift+c"], "command": "copy_path" } | |
] |
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
// Sublime 3, comes installed with Rails package. This also provide "Ruby Haml". If you press ctrl + alt + p and type haml you will probably see two Set Syntax: Ruby Haml. | |
// The best solution for me was also install ApplySyntax and in it's user settings add the following: | |
// Put your custom syntax rules here: | |
"syntaxes": [ | |
{ | |
// This rule could be incorporated into the next one, but I prefer to be | |
// more explicit rather than less | |
"name": "Haml/Syntaxes/Ruby Haml", |
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
class Project < ActiveRecord::Base | |
STATUS_TRANSITIONS = | |
{ | |
initial: :not_started, | |
not_started: { value: "On the board" }, | |
recommendation_sent: { value: "Recs: Recommendations Sent", event: :recommend}, | |
restarted: { event: :restart, to: :not_started } | |
} |
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
var module = new function() { | |
var define, definitions, require; | |
definitions = {}; | |
define = function(moduleName, dependencies, fn) { | |
if (fn === undefined) { | |
fn = dependencies; | |
dependencies = []; | |
} | |
definitions[moduleName] = { | |
dependencies: dependencies, |
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
sudo apt-get update | |
sudo apt-get install curl | |
curl -L https://get.rvm.io | bash -s stable | |
source ~/.rvm/scripts/rvm | |
rvm requirements |
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
# gem 'aws-sdk' | |
require 'aws-sdk' | |
AWS.config(:access_key_id => '', :secret_access_key => '') | |
policy = '{ | |
"Id": "Policy1380877762691", | |
"Statement": [ | |
{ |
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
# Sorts an array based on a property of each object within the array | |
# | |
# Examples: | |
# | |
# [Em.Object.create(a: 1), Em.Object.create(a: 5), Em.Object.create(a: 3)].sortProperty('a') | |
# > [{a: 1}, {a: 3}, {a: 5}] | |
# | |
# As a computed property: | |
# | |
# AC = Em.ArrayController.extend |