Skip to content

Instantly share code, notes, and snippets.

View kitallis's full-sized avatar
🍣

Akshay Gupta kitallis

🍣
View GitHub Profile
# gem install sishen-rtranslate
class String
require 'rtranslate'
def to_de
Translate.t self, "ENGLISH", "GERMAN"
end
end
puts "you're welcome".to_de
@kitallis
kitallis / .vimrc
Created November 13, 2011 18:02
kitallis' vim configuration
" ------
" Vundle
" ------
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
@kitallis
kitallis / rspec-syntax-cheat-sheet.rb
Created February 10, 2012 09:50 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
# encoding: utf-8
require 'bloops'
class Bloopsaposi
def initialize
@x = {119135 => "2:"}
@q = []
@b = Bloops.new
# encoding: utf-8
class NP
def initialize a=@p=[], b=@b=[]
end
def +@
@b << 1
b2c
end
@kitallis
kitallis / srshti_vim.md
Created April 11, 2012 12:24 — forked from jasim/srshti_vim.md
Shortcuts for VimGet

#Basic Stuff#

##Movements##

  • Goto next word w
  • Goto previous word b
  • Select inner word viw
  • Select the inner block - vi{
  • Go to closing or opening tag - %
@kitallis
kitallis / newal.rb
Created July 22, 2012 03:02
override inner eval()
module Newal
def eval(str)
throw :evaling, [true, Kernel.eval(str)]
end
end
class << self
include Newal
end
@kitallis
kitallis / newal.rb
Created July 27, 2012 07:45
override instance_eval()
class Object
alias :old_instance_eval :instance_eval
def instance_eval(str, *args)
throw :evaling, [true, old_instance_eval(str)]
end
end
$result = catch(:evaling) do
<%= user_code %>
@kitallis
kitallis / raskell.rb
Created August 16, 2012 14:32 — forked from andkerosine/raskell.rb
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@kitallis
kitallis / migration.rake
Created August 28, 2012 15:12
rebase migrations
namespace :migrations do
DB_PATH = ActiveRecord::Migrator.migrations_path
SEPARATOR = " --- "
UPTO = ENV['upto']
def run_command(command)
%x(#{command}).tap do |result|
status = $?
unless status.success?
raise "Command Error -- (#{status.exitstatus}): [#{command}]"