Skip to content

Instantly share code, notes, and snippets.

View karthiks's full-sized avatar
😄
Playing with GraphQL

Karthik Sirasanagandla karthiks

😄
Playing with GraphQL
View GitHub Profile
@karthiks
karthiks / rspec-syntax-cheat-sheet.rb
Created September 9, 2011 18:19 — 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")
@karthiks
karthiks / pre-commit
Created October 27, 2011 03:28 — forked from holysugar/pre-commit
git pre-commit warning to trailing whitespaces
#!/bin/sh
function error() {
echo "'$1' has trailing spaces.\n" >&2
}
git diff --cached --name-only | (while read f; do
ERROR=0
if grep -n '[[:space:]]$' "$f" ; then
error $f
@karthiks
karthiks / compile-ooo3.sh
Created November 28, 2011 11:59 — forked from shyam/compile-ooo3.sh
comping OpenOffice.org3 for headless mode operations ( like watermarking, pdf processing, etc., )
# tested on an EL5 based platform
yum -y install perl-Archive-Zip ant bison flex pam-devel cups-devel gperf libxslt-devel openldap-devel gstreamer-devel gstreamer-plugins-base-devel db4-devel unixODBC-devel xalan-j2 boost-devel unixODBC-devel qt-devel subversion autoconf automake gtk2-devel gcc-c++ gnome-vfs2-devel rpm-build expat-devel python-devel curl-devel gcc gcc-c++ java-1.6.0-openjdk-devel libIDL-devel libXaw-devel bison
wget https://raw.github.com/gist/1247669/88133c7c8da53d257c38ff73b161d116aed18c13/dot-screenrc -O ~/.screenrc
wget http://download.services.openoffice.org/files/stable/3.3.0/OOo_3.3.0_src_core.tar.bz2
wget http://download.services.openoffice.org/files/stable/3.3.0/OOo_3.3.0_src_system.tar.bz2
tar xjf OOo_3.3.0_src_core.tar.bz2
tar xjf OOo_3.3.0_src_system.tar.bz2
cd ~/OOO330_m20/
wget http://tools.openoffice.org/unowinreg_prebuild/680/unowinreg.dll -O ./external/unowinreg/unowinreg.dll
@karthiks
karthiks / gist:1858132
Created February 18, 2012 08:03 — forked from michaelfeathers/gist:1855765
Five lines that turn Ruby into a different language
class Object
def method_missing m, *args
Object.respond_to?(m, true) ? Object.send(m, self, *args) : super
end
end
@karthiks
karthiks / ideal ops.md
Created June 14, 2012 11:57 — forked from elmer/ideal ops.md
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan

@karthiks
karthiks / gist:3009692
Created June 28, 2012 07:34 — forked from michaeldauria/gist:2048022
Migrating from Copycopter to your own instance
Once you have your own instance of copycopter-server running, you need to do the following:
1. Create a new project and take note of its hostname and api key
2. Make sure you are on the latest version of the copycopter_client gem, at the time of this writing it is 2.0.0
3. Export the latest version of your published drafts:
$ RAILS_ENV=production bundle exec rake copycopter:export
@karthiks
karthiks / gist:3012662
Created June 28, 2012 17:24 — forked from dblack/gist:3012525
Behavior of take_while and drop_while without a block
I'm puzzled by the behavior of take_while and drop_while when called without
a block. They return enumerators -- that part I understand -- but I'm not
understanding how those enumerators behave.
Here's what I mean:
>> enum = [1,2,3,4,5].take_while
=> #<Enumerator: [1, 2, 3, 4, 5]:take_while>
>> enum.next
=> 1
@karthiks
karthiks / .vimrc
Created October 20, 2012 15:27 — forked from localshred/.vimrc
Vimrc
"-------------------------------------------------------------------[Vundle]----
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'kien/ctrlp.vim'
Bundle 'mileszs/ack.vim'

Notes on teaching both test/unit and RSpec to new Ruby developers

@tenderlove asked "Is it good to teach RSpec (vs t/u) to people who are totally new to Ruby?" I have experience suggesting that it is a good thing; after a short back and forth, it seemed useful to write it up in detail.

Background

This goes back several years, to when I was the primary Ruby/Rails trainer for Relevance from 2006-2009. I'm guessing that worked out to probably 6-8 classes a year during those years. Since then, RSpec has changed a fair amount (with the addition of expect) and test/unit has changed radically (it has an entirely new implementation, minitest, that avoids some of the inconsistencies that made test/unit a bit confusing during the time I'm writing about here).

I started out as an RSpec skeptic. I've never been afraid of what a lot of people denigrate as "magic" in Ruby libraries … to me, if you take the trouble to understand it, that stuff's just pr

@karthiks
karthiks / permissions.txt
Created January 8, 2017 18:32 — forked from Rainer-Lang/permissions.txt
A list of all Android permissions...
android.permission.ACCESS_ALL_DOWNLOADS
android.permission.ACCESS_BLUETOOTH_SHARE
android.permission.ACCESS_CACHE_FILESYSTEM
android.permission.ACCESS_CHECKIN_PROPERTIES
android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY
android.permission.ACCESS_DOWNLOAD_MANAGER
android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED
android.permission.ACCESS_DRM_CERTIFICATES
android.permission.ACCESS_EPHEMERAL_APPS
android.permission.ACCESS_FM_RADIO