Skip to content

Instantly share code, notes, and snippets.

View jraregris's full-sized avatar

Oddmund Strømme jraregris

View GitHub Profile
describe Klassen do
describe metode do
it "should throw execption when given no parameters" do
...
end
it "should return whatever when given whatever" do
...
end
end
def digit_sum n
n > 9 ? n.to_s.chars.map{ |i| digit_sum(i.to_i) }.inject(:+) : n
end
def accumulative_sum n
(1..n).map{|i| digit_sum i}.inject(:+)
end
puts accumulative_sum 11
⮁ pry
[1] pry(main)> class Parent
[1] pry(main)* private
[1] pry(main)* def honk
[1] pry(main)* puts "hooonk"
[1] pry(main)* end
[1] pry(main)* end
=> :honk
[2] pry(main)> class Child < Parent
[2] pry(main)* end
{"repository"=>
{"url"=>"https://github.com/izzm/Squat-cafe",
"has_downloads"=>true,
"created_at"=>"2012/01/15 04:15:11 -0800",
"has_issues"=>true,
"description"=>"",
"forks"=>1,
"fork"=>false,
"has_wiki"=>true,
"homepage"=>"",
// Type: System.Collections.Generic.IEnumerable`1
// Assembly: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll
using System.Collections;
using System.Runtime.CompilerServices;
namespace System.Collections.Generic
{
/// <summary>
*font: -*-terminus-*-*-*-*-16-*-*-*-*-*-*-*
urxvt.scrollBar: false
urxvt.loginShell: true
URxvt.perl-ext-common: default,url-select
URxvt.keysym.M-u: perl:url-select:select_next
URxvt.urlLauncher: firefox
URxvt.underlineURLs: true
@jraregris
jraregris / bash.bat
Created September 21, 2012 09:29
Git-BASH (mingw32) with Visual Studio enviroment
@echo off
@REM Select the latest VS Tools
IF EXIST %VS110COMNTOOLS% (
CALL "%VS110COMNTOOLS%\vsvars32.bat"
GOTO :start_term
)
IF EXIST %VS100COMNTOOLS% (
CALL "%VS100COMNTOOLS%\vsvars32.bat"
GOTO :start_term
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Bundles:
Bundle 'gmarik/vundle'
Bundle 'Lokaltog/vim-powerline'
Bundle 'Lokaltog/vim-distinguished'
@jraregris
jraregris / gist:3569872
Created September 1, 2012 11:05
Bass buttons on my brother's accordion
module Accordion
TONES = ['C ', 'C#', 'D ', 'D#', 'E ', 'F ', 'F#', 'G ', 'G#', 'A ', 'A#', 'B ']
def get_tone t
TONES[t%12]
end
def rel tone, dist
get_tone((TONES.find_index(tone) + dist) % 12)
end
➜ ~ git clone git://github.com/sstephenson/rbenv.git .rbenv
Cloning into '.rbenv'...
remote: Counting objects: 1040, done.
remote: Compressing objects: 100% (418/418), done.
remote: Total 1040 (delta 649), reused 961 (delta 594)
Receiving objects: 100% (1040/1040), 138.42 KiB, done.
Resolving deltas: 100% (649/649), done.
➜ ~ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
➜ ~ echo 'eval "$(rbenv init -)"' >> ~/.zshenv
➜ ~ echo 'eval "$(rbenv init -)"' >> ~/.zshenv