These days, go to Apple's app store and get Xcode.
Open Xcode
# 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 |
####################################################################### | |
# Setup Paths | |
function prepend_to_path -d "Prepend the given dir to the PATH if it exists and is not already | |
included within the PATH" | |
if test -d $argv[1] | |
if not contains $argv[1] $PATH | |
set -gx PATH "$argv[1]" $PATH | |
end | |
end |
# Some good references are: | |
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x | |
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/ | |
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392 | |
#1. Install PostgreSQL postgis and postgres | |
brew install postgis | |
initdb /usr/local/var/postgres | |
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start |
#!/usr/bin/env ruby | |
=begin | |
= Geographic Searches With Postgres's Earthdistance and Cube Extensions | |
This program shows how to easily create a Postgres database that uses the Cube | |
and Earthdistance extensions to perform fast queries on geographic data. | |
Briefly, the problem this code solves is "show me all places within 50 | |
kilometers of New York City." |
# see https://github.com/thomasjbradley/signature-pad for more details | |
instructions = JSON.load(data).map { |h| "line #{h['mx']},#{h['my']} #{h['lx']},#{h['ly']}" } * ' ' | |
system "convert -size 198x55 xc:transparent -stroke blue -draw '#{instructions}' signature.png" |
http://production.cf.rubygems.org/gems/<name>-<version>-<platform>.gem | |
http://docs.rubygems.org/read/chapter/6#page20 |
#!/usr/bin/env ruby | |
# | |
# Usage: | |
# ruby validate_original_gem.rb /path/to/gem/gemname.rb | |
require 'openssl' | |
require 'digest/sha1' | |
require 'zlib' | |
module Verify |
#!/usr/bin/env sh | |
set -e | |
if ! which md5sum > /dev/null; then | |
echo Install md5sum | |
exit 1 | |
fi | |
if ! which curl > /dev/null; then |
require 'erb' | |
namespace :db do | |
namespace :generate do | |
desc "Generate a config/database.conf" | |
task :config do | |
db_example = Rails.root.join("config/database.yml.erb") | |
print "What is your password for your local database? (leave empty for no password): " | |
# get data |