This file contains hidden or 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
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
This file contains hidden or 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
| alias server='open http://localhost:8000 && python -m SimpleHTTPServer' |
This file contains hidden or 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
| # coding: utf-8 | |
| require 'sinatra' | |
| set server: 'thin', connections: [] | |
| get '/' do | |
| halt erb(:login) unless params[:user] | |
| erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
| end | |
| get '/stream', provides: 'text/event-stream' do |
This file contains hidden or 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
| source "http://rubygems.org/" | |
| gem "sinatra", "~> 1.3.0" | |
| gem "thin" |
This file contains hidden or 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
| Gem::Specification.new do |s| | |
| s.name = 'bang' | |
| s.version = '0.1.0' | |
| s.platform = Gem::Platform::RUBY | |
| s.author = 'Jeff Kreeftmeijer' | |
| s.email = '[email protected]' | |
| s.summary = 'Bang!' | |
| s.description = 'Bangs existing model methods' | |
| s.files = ['bang.rb'] |
This file contains hidden or 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 ruby | |
| # Usage: gitio URL [CODE] | |
| # | |
| # Turns a github.com URL | |
| # into a git.io URL | |
| # | |
| # Copies the git.io URL to your clipboard. | |
| url = ARGV[0] | |
| code = ARGV[1] |
This file contains hidden or 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
| app.get('/help', function(req, res){ | |
| res.send('some help'); | |
| }); | |
| app.get('/search/:query/p:page', function(req, res){ | |
| var query = req.params.query | |
| , page = req.params.page; | |
| res.send('search "' + query + '", page ' + (page || 1)); | |
| }); |
This file contains hidden or 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
| # encoding: UTF-8 | |
| Capistrano::Configuration.instance(:must_exist).load do | |
| namespace :rails do | |
| desc "Open the rails console on one of the remote servers" | |
| task :console, :roles => :app do | |
| hostname = find_servers_for_task(current_task).first | |
| exec "ssh -l #{user} #{hostname} -t 'source ~/.profile && #{current_path}/script/rails c #{rails_env}'" | |
| end | |
| end |
This file contains hidden or 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
| # avoid path traversal attacks and speed up look-up | |
| set :css_files, {} | |
| Dir.glob("#{settings.public}/css/*.css") { |file| settings.css_files[File.basename(file, '.css')] = file } | |
| get "/css/:name.css" do |name| | |
| expires 60*60*24*356*3 | |
| send_file setting.css_files[name] | |
| end |
This file contains hidden or 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
| $> launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist | |
| $> /usr/local/Cellar/mysql/5.5.9/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.5.9 --datadir=/usr/local/Cellar/mysql/5.5.9/data --plugin-dir=/usr/local/Cellar/mysql/5.5.9/lib/plugin --log-error=/usr/local/Cellar/mysql/5.5.9/data/errors.err --pid-file=/usr/local/Cellar/mysql/5.5.9/data/pidfile.pid --skip-grant-tables | |
| $> mysql | |
| mysql> UPDATE mysql.user SET Password=PASSWORD('root_password') WHERE User='root'; | |
| mysql> FLUSH PRIVILEGES; | |
| $> kill `cat /usr/local/Cellar/mysql/5.5.9/data/pidfile.pid` |