This file contains hidden or 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 "benchmark" | |
def log msg | |
# NOOP | |
end | |
def with_if(x) | |
x.times do |n| | |
if (n % 3 == 0) && (n % 5 != 0) | |
log 'Fizz' |
This file contains hidden or 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
" Call rspec from vim | |
" Apr 21st, 2014 Andi Altendorfer <[email protected]>, License MIT | |
" | |
" RunCurrentLine() ... evaluate current line with ruby-interpreter and append " output to the end of the line | |
" RunCurrentFile() ... evaluate current file with ruby-interpreter and append " output to the end of the file | |
" | |
" Copy this file to your ./vim/pluglin directory | |
function! RunCurrentLine () | |
exec "normal! $F#D" | |
let _current_line = getline(".") |
This file contains hidden or 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
" Call rspec from vim | |
" Apr 21st, 2014 Andi Altendorfer <[email protected]> | |
" | |
" RspecLine() ... run rspec for the current cursor line | |
" RspecFile() ... run rspec for the current file | |
" RspecAll() .... run entire suite | |
" | |
" Copy this file to your ./vim/pluglin directory | |
function RspecLine() |
This file contains hidden or 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
" Call rspec from vim | |
" Apr 21st, 2014 Andi Altendorfer <[email protected]> | |
" | |
" RspecLine() ... run rspec for the current cursor line | |
" RspecFile() ... run rspec for the current file | |
" RspecAll() .... run entire suite | |
" | |
" Copy this file to your ./vim/pluglin directory | |
function RspecLine() |
This file contains hidden or 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 'ostruct' | |
# ad 1) | |
def sort_descending1 _objects, field | |
_objects.sort { |b,a| a.send(field) <=> b.send(field) } | |
end | |
# ad 2) | |
def safe_compare2 a,b,field | |
a.send(field) <=> b.send(field) |
This file contains hidden or 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
" Vim color file | |
" Original Maintainer: Lars H. Nielsen ([email protected]) | |
" Last Change: 2010-07-23 | |
" | |
" Converting for 256-color terminals by | |
" Danila Bespalov ([email protected]) | |
" with great help of tool by Wolfgang Frisch ([email protected]) | |
" inspired by David Liang's version ([email protected]) | |
set background=dark |
This file contains hidden or 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
# WORKS THE FIRST TIME BUT FAILES WHEN RETURNING TO THE PAGE UNLESS RELOADING | |
jQuery -> | |
$('.clickable-row td').click -> | |
target_id = $(this).parent().attr('id').replace /row-id-/,'' | |
document.location = "/controller_xy/#{target_id}/edit" | |
# WORKS FINE EVERY TIME | |
jQuery -> | |
$(document).on( 'click', '.clickable-row td', -> |
This file contains hidden or 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 Foo | |
attr_reader :bar | |
def initialize | |
@bar = 123 | |
ObjectSpace.define_finalizer( self, self.class.finalize(bar) ) | |
end | |
def self.finalize(bar) | |
proc { puts "DESTROY OBJECT #{bar}" } | |
end |
This file contains hidden or 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
set-window-option -g utf8 on | |
set -g mode-mouse on | |
set -g mouse-resize-pane on | |
set -g mouse-select-pane on | |
set -g mouse-select-window on | |
set-option -g prefix C-q | |
set -g history-limit 50000 | |
unbind-key C-b | |
bind-key q send-prefix | |
set -g base-index 1 |