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
http://xrvg.rubyforge.org/ | |
XRVG stands for "eXtended Ruby Vector Graphics". The purpose of this project is to define and implement a high-level and powerful programming environment for vector graphics generation. | |
XRVG does not consist in "yet another" graphical front end to draw vector graphics. XRVG even does not produce images by itself. | |
XRVG must rather be viewed as an abstract and computational way of designing graphics by programmatic means (see philosophy for further discussion). | |
XRVG is a Ruby extension, that generates SVG content. | |
http://rubyforge.org/projects/ruby-gd/ | |
http://rgplot.rubyforge.org/ |
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
class ERB | |
class Compiler | |
def compile(s) | |
enc = s.encoding | |
raise ArgumentError, "#{enc} is not ASCII compatible" if enc.dummy? | |
s = s.dup.force_encoding("ASCII-8BIT") # don't use constant Enoding::ASCII_8BIT for miniruby | |
enc = detect_magic_comment(s) || enc | |
out = Buffer.new(self, enc) |
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
function pr(varargin) | |
if nargin == 0, return, end % stop if no arguments | |
% check if the first argument is a string with output format: | |
if ischar(varargin{1}) && ~isempty(regexp(varargin{1},'\%[^\s]','ONCE')) | |
cmd = 'sprintf(varargin{1}'; | |
for i=2:nargin, | |
if iscell(varargin{i}), | |
% if an argument is a cell array, then consider it as collected parameters: | |
for j=1:length(varargin{i}) | |
cmd = sprintf('%s, varargin{%d}{%d}', cmd, i, j); |
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
require 'yaml' | |
require 'pp' | |
hash = YAML.load ' | |
a: | |
after: | |
before: | |
l: | |
after: | |
before: | |
n: |
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
namespace :db do | |
desc 'Open a MongoDB console with connection parameters for the current Rails.env' | |
task :console => :environment do | |
conn = Mongoid.master.connection | |
opts = '' | |
opts << ' --username ' << conn.username if conn.username rescue nil | |
opts << ' --password ' << conn.password if conn.password rescue nil | |
opts << ' --host ' << conn.host | |
opts << ' --port ' << conn.port.to_s | |
system "mongo #{opts} #{Mongoid.master.name}" |
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
# .irbrc to log goodies like SQL/Mongo queries to $stdout if in Rails 3 console | |
if defined?(Rails) && Rails.respond_to?(:logger) | |
require 'logger' | |
Rails.logger = Logger.new($stdout) | |
if defined?(Mongoid) | |
Mongoid.logger = Rails.logger | |
end | |
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
virtualenv --no-site-packages . | |
source bin/activate | |
bin/pip install Django psycopg2 django-sentry | |
bin/pip freeze > requirements.txt | |
bin/django-admin.py startproject mysite | |
cat >.gitignore <<EOF | |
bin/ | |
include/ | |
lib/ | |
EOF |
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
https://raw.github.com/gist/866c79035a2d066a5850/c1b28c7d756aa87217923020b663601e1c6b7281/README.txt | |
~/app $ virtualenv --no-site-packages . | |
~/app $ bin/pip install Django psycopg2 | |
~/app $ bin/pip freeze > requirements.txt | |
~/app $ bin/django-admin.py startproject mysite | |
~/app $ cat >.gitignore <<EOF |
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
virtualenv --no-site-packages . | |
source bin/activate | |
bin/pip install Django psycopg2 django-sentry | |
bin/pip freeze > requirements.txt | |
bin/django-admin.py startproject mysite | |
cat >.gitignore <<EOF | |
bin/ | |
include/ | |
lib/ | |
EOF |
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
#!/bin/bash | |
mkdir prancing_heroku | |
cd prancing_heroku | |
django-admin.py startproject prancing_heroku | |
echo "Django==1.3" > requirements.txt | |
echo "psycopg2" >> requirements.txt | |
echo "web: prancing_heroku/run_heroku_run.sh" > Procfile |
OlderNewer