Skip to content

Instantly share code, notes, and snippets.

View toamitkumar's full-sized avatar
🏠
Working from home

Amit Kumar toamitkumar

🏠
Working from home
View GitHub Profile
require 'active_support/dependencies'
module ActiveSupport::Dependencies
alias_method :require_or_load_without_multiple, :require_or_load
def require_or_load(file_name, const_path = nil)
if file_name.starts_with?(Rails.root.to_s + '/app')
relative_name = file_name.gsub(Rails.root.to_s, '')
@engine_paths ||= Rails::Application::Railties.engines.collect{|engine| engine.config.root.to_s }
@engine_paths.each do |path|
engine_file = File.join(path, relative_name)
require_or_load_without_multiple(engine_file, const_path) if File.file?(engine_file)
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = ExampleViewController.alloc.init
@window.makeKeyAndVisible
true
end
end
@toamitkumar
toamitkumar / gist:3038214
Created July 3, 2012 07:13
testing rubymotion
it 'should perform a long running operation' do
@ary.performSelector("addObject:", withObject:"soup", afterDelay:0.5)
wait 0.6 do
@ary.size.should.be 1
end
end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.1" toolsVersion="2182" systemVersion="11E53" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="TW7-Kq-wgK">
<dependencies>
<deployment defaultVersion="1296" identifier="iOS"/>
<development defaultVersion="4200" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1181"/>
</dependencies>
<scenes>
<!--View Controller - Item 2-->
<scene sceneID="po5-V2-n83">
{% if site.coderwall_user %}
<section>
<h1>Coderwall Badges</h1>
<ul id="cw_badges">
<li class="loading">Status updating...</li>
</ul>
<p id="badges"></p>
<script type="text/javascript">
function show_achievements(args) {
var badges = args["data"]["badges"];
url: http://toamitkumar.github.com
title: RubyizednRailified Blog
subtitle: Ruby, Rails and others.
author: Amit Kumar
simple_search: http://google.com/search
description: toamitkumar
date_format: "ordinal"
subscribe_rss: /atom.xml
subscribe_email:
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'uri'
# usage: ruby blogger_import.rb my-blog.xml
data = File.read ARGV[0]
doc = Nokogiri::XML(data)
class Product
def initialize
@name = "Ruby Book"
@price = 20.65
end
end
product = Product.new
hash = {}
product.instance_variables.each {|attr| hash[attr.to_s.delete("@")] = product.instance_variable_get(attr) }
@toamitkumar
toamitkumar / gist:2307763
Created April 5, 2012 03:38
Capistrano Extension
@toamitkumar
toamitkumar / hack.sh
Created April 3, 2012 05:43 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#