If you want to do some housekeeping locally and want to remove branches that have been merged, checkout master
and then:
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
# usage: repeatme 3 "echo e" | |
function repeatme() { | |
for i in $(seq 1 $1) ; do | |
$2 | |
done | |
} |
Failure/Error: expect(resource_time.to_time).to eq Time.now | |
expected: 2015-04-29 15:23:34 +0100 | |
got: 2015-04-29 15:23:34 +0100 | |
# Solution: | |
expect(resource_time.to_s).to eq Time.now.utc.to_s |
class SuperServiceObject | |
attr_reader :user, :options | |
def new(user_id, options = {}) | |
@user = User.find(user_id) | |
@options = options | |
end | |
def call | |
# move the code here |
/* Exercise: Loops and Functions #43 */ | |
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func Sqrt(x float64) float64 { | |
z := float64(2.) |
https://github.com/bbatsov/rubocop#atom | |
https://github.com/yujinakayama/atom-lint | |
https://github.com/AtomLinter/linter-rubocop | |
https://github.com/AtomLinter/Linter |
If you want to do some housekeeping locally and want to remove branches that have been merged, checkout master
and then:
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
-module(fact). | |
-export([factorial/1]). | |
%% The solution is tail recursive | |
factorial(N) -> | |
factorial(1, N, 1). | |
factorial(Current, N, Result) when Current =< N -> | |
NewResult = Result * Current, |
// Bad Code from Efytimes: | |
// http://efytimes.com/e1/fullnews.asp?edid=128774 | |
// Please don't use this code in your website if you have jQuery > 1.9 | |
$(document).ready(function() { | |
// If the browser type if Mozilla Firefox | |
if ($.browser.mozilla && $.browser.version >= "1.8" ){ | |
// some code | |
} | |
// If the browser type is Opera |
#!/usr/bin/env ruby | |
# show queries | |
def logs_on | |
if defined?(ActiveRecord) | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Base.clear_reloadable_connections! | |
"Logs on!" | |
end | |
end |
#!/usr/bin/env ruby | |
def r! | |
reload! | |
end | |
if ENV['RAILS_ENV'] | |
load "#{ENV['HOME']}/.railsrc" | |
end |