Skip to content

Instantly share code, notes, and snippets.

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

Nikhil Gupta nikhgupta

🏠
Working from home
View GitHub Profile
@nikhgupta
nikhgupta / gitolite.conf
Created January 25, 2011 13:09
a bash script which automates creation of a local git repository, modifies gitolite.conf file as needed, and then syncs the repo with an online gitolite (and github) server you must have repos defined the way in attached gitolite.conf file
# gitolite conf
# please see conf/example.conf for details on syntax and features
# do not remove hashes from the following macros
# if you add a macro, remember to update ~/bin/init-gitolite.sh
@public-readable = #
@public-writable = testing #
@client-works = #
repo @client-works
@nikhgupta
nikhgupta / rails_template.rb
Created July 17, 2011 03:39
Default template for new Rails applications
initializer 'generators.rb', <<-RUBY
Rails.application.config.generators do |g|
end
RUBY
@recipes = ["activerecord", "cucumber", "devise", "git", "haml", "heroku", "jammit", "jquery", "rails_admin", "sass", "settingslogic"]
def recipes; @recipes end
def recipe?(name); @recipes.include?(name) end
@bradleyayers
bradleyayers / gist:1660182
Created January 23, 2012 02:59
Save to `/etc/dbus-1/system.d/Upstart.conf` to enable Upstart user jobs
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Only the root user can own the Upstart name -->
<policy user="root">
<allow own="com.ubuntu.Upstart" />
</policy>
@nikhgupta
nikhgupta / newrails.bash
Created March 17, 2012 08:58
a bash function to create a new rails project with some defaults
# note that the database is being used with login: root/password
# make necessary changes if you are using something else or simple remove that block
function newrails() {
app="$1"; ruby="${2:-1.9.3@rails}";
if [ -n "${app}" ]; then
read -r -d '' gemfile <<-'EOF'
group :test, :development do
gem 'turn'
gem 'rspec-rails'
gem 'capybara'
@jedschneider
jedschneider / gh-pages-tips.md
Created June 7, 2012 17:59
github pages tips for jekyll wiki

Working With Github Pages

The FAQ maintained by Github covers most stumbling blocks, some other tips and tricks supplied here.

Gitignore

Add _site to .gitignore. The generated site should not be uploaded to Github since its gets generated by github.

Working With Code Partials

@schmurfy
schmurfy / gist:3199254
Created July 29, 2012 14:33
Install pandoc Mac OS X 10.8
# Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg
$ sudo chown -R `whoami` /usr/local/texlive
$ tlmgr update --self
$ tlmgr install ucs
$ tlmgr install etoolbox
# Install pandoc view homebrew
@minikomi
minikomi / editor.html
Last active November 11, 2021 10:16
my editor
data:text/html,
<style type="text/css">
#e {
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
font-size:16px;
}
@tybenz
tybenz / urlshort.sh
Created February 7, 2013 23:02
Bash URL Shortener
#!/bin/bash
echo "Generating URL..."
FULL_PATH="/Users/tbenzige/Projects/aws"
#Count is kept based on a list.txt file
#list.txt is a plain text file meant to show relationships between URLs
#Instead of a running count, we just count the lines in list.txt
INITIAL=`echo -n $(cat $FULL_PATH/list.txt | wc -l)`
NUM="$INITIAL/4"
@alex-zige
alex-zige / gist:5795358
Last active June 8, 2023 07:49
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@abevoelker
abevoelker / foo_spider.py
Last active August 29, 2015 13:59
scrapy Sidekiq pipeline (resque support shouldn't be too hard)
# project_name/spiders/foo_spider.py
from scrapy.contrib.spiders import CrawlSpider
class FooSpider(CrawlSpider):
post_process = dict(
klass = "Foo::Worker",
# queue = "default",
# retry = True,
)