###generate a random string of 8 characters
('a'..'z').to_a.shuffle[0..7].join
This file contains 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
# 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 |
This file contains 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
<?php | |
function exportMysqlToCsv($table,$filename = 'export.csv') | |
{ | |
$csv_terminated = "\n"; | |
$csv_separator = ","; | |
$csv_enclosed = '"'; | |
$csv_escaped = "\\"; | |
$sql_query = "select * from $table"; | |
This file contains 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
<?php | |
// PHP script to allow periodic cPanel backups automatically, optionally to a remote FTP server. | |
// This script contains passwords. KEEP ACCESS TO THIS FILE SECURE! (place it in your home dir, not /www/) | |
// ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED ********* | |
// Info required for cPanel access | |
$cpuser = "username"; // Username used to login to CPanel | |
$cppass = "password"; // Password used to login to CPanel |
This file contains 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
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 |
This file contains 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
# Application Generator Template | |
# Modifies a Rails app to use Devise with RSpec and Cucumber | |
# Usage: rails new APP_NAME -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-devise-rspec-cucumber-template.rb -T | |
# Information and a tutorial: | |
# https://github.com/RailsApps/rails3-devise-rspec-cucumber | |
# Generated using the rails_apps_composer gem: | |
# https://github.com/RailsApps/rails_apps_composer/ |
This file contains 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
User Model | |
========== | |
require 'digest' | |
class User < ActiveRecord::Base | |
attr_accessor :password | |
has_one :profile | |
has_many :articles, :order => 'published_at DESC, title ASC', | |
:dependent => :nullify | |
has_many :replies, :through => :articles, :source => :comments |
This file contains 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
// This is written in pseudo language | |
class Foo { | |
def bar() { | |
ret "it Works!"; | |
} | |
} | |
$f = Foo.new(); | |
print $f.bar(); |
This file contains 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
# 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' |
This file contains 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
#!/usr/bin/env /Users/nikhilgupta/.rvm/wrappers/ruby-1.9.3-p0@tools/ruby | |
# a tiny script that crawls 'railscasts.com' and stores the path to MP4 versions | |
# of the episodes in the file: 'downloads.txt' | |
# currently, set to track only the last 3 pages of the site's free section. | |
# you can then run: $(for tut in `cat downloads.txt`; do wget --continue $tut; done) to download them. | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' |
OlderNewer