Look up Ruby motions by running :help ruby-motion
.
command | effect |
---|
public String toLowerCase(Locale locale) { | |
if (locale == null) { | |
throw new NullPointerException(); | |
} | |
int firstUpper; | |
/* Now check if there are any characters that need to be changed. */ | |
scan: { | |
for (firstUpper = 0 ; firstUpper < count; ) { |
# A shortcut function that simplifies usage of xclip. | |
# - Accepts input from either stdin (pipe), or params. | |
# ------------------------------------------------ | |
cb() { | |
local _scs_col="\e[0;32m"; local _wrn_col='\e[1;31m'; local _trn_col='\e[0;33m' | |
# Check that xclip is installed. | |
if ! type xclip > /dev/null 2>&1; then | |
echo -e "$_wrn_col""You must have the 'xclip' program installed.\e[0m" | |
# Check user is not root (root doesn't have access to user xorg server) | |
elif [[ "$USER" == "root" ]]; then |
[Desktop Entry] | |
Encoding=UTF-8 | |
Name=nocaps | |
Comment=Remap caps lock as control | |
Exec=setxkbmap -option ctrl:nocaps | |
Terminal=true |
set nocompatible " be iMproved | |
filetype off " required! | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" let Vundle manage Vundle | |
" required! | |
Bundle 'gmarik/vundle' |
(function($) { | |
$.fn.shuffle = function() { | |
var allElems = this.get(), | |
getRandom = function(max) { | |
return Math.floor(Math.random() * max); | |
}, | |
shuffled = $.map(allElems, function() { | |
var random = getRandom(allElems.length), | |
randEl = $(allElems[random]).clone(true)[0]; | |
allElems.splice(random, 1); |
def nav_link_to(link_text, link_path) | |
class_name = current_page?(link_path) ? 'selected' : '' | |
content_tag(:li, class: class_name) do | |
link_to link_text, link_path | |
end | |
end |
# filename spec/fake_set_spec.rb | |
require 'spec_helper' | |
require 'fake_set' | |
describe FakeSet, '#union' do | |
set1 = FakeSet.new(1, 2, 3) | |
set2 = FakeSet.new(3, 4, 5) | |
expect(set1.union(set2)).to eq FakeSet.new(1, 2, 3, 4, 5) |
# filename: spec/fake_set_spec.rb | |
require 'spec_helper' | |
require 'fake_set' | |
describe FakeSet, '#union' do | |
it "unions elements of two set" do | |
set1 = FakeSet.new([1, 2, 3]) | |
set2 = FakeSet.new([3, 4, 5]) | |
expect(set1.union(set2).data).to eq [1, 2, 3, 4, 5] |
Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.
Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.
First you will need to get an OAuth Token from GitHub using your own username and "note"