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
| require 'csv' # ruby 1.9 | |
| class FromCSV | |
| def initialize(file) | |
| col_names = nil | |
| CSV.open(file, "r") { |csv_file| col_names = csv_file.shift } # reads first line of the CSV file | |
| @file = file | |
| class <<self | |
| self | |
| end.class_eval 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
| #!/usr/bin/env ruby | |
| # giftube – Generates an animated gif from a YouTube url. | |
| # | |
| # Usage: | |
| # | |
| # giftube [youtube url] [minute:second] [duration] | |
| # | |
| # ex. | |
| # |
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
| module DateFilterable | |
| private | |
| def filterable_by(field) | |
| class_filter = %Q{def filter_by_date(min,max=nil) | |
| if max.nil? | |
| where("#{field} > :min_date", { :min_date => min } ) | |
| else | |
| where("#{field} >= :min_date, #{field} < :max_date", { :min_date => min, :max_date => max } ) | |
| 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
| class Risp | |
| @@envs = [] | |
| def initialize | |
| define_environment({}) | |
| end | |
| def eval(arg) | |
| if arg.is_a? Symbol # accessor | |
| @env[arg] | |
| elsif !arg.is_a? Array # atom - is not a list |
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://gems.github.com" | |
| source "http://gemcutter.org" | |
| bundle_path "gems" | |
| gem "dm-core" | |
| gem "dm-migrations" | |
| gem "dm-sweatshop" | |
| gem "data_objects" | |
| gem "do_postgres" |
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
| "Recursive-descent parser for Regexes, based on: http://matt.might.net/articles/parsing-regex-with-recursive-descent/ \ | |
| Test project for Emacs + Python" | |
| class Parser(): | |
| "Recursive descent regex parser" | |
| def __init__(self, regex): | |
| "Initializes the parser with the regex string" | |
| self.input = regex | |
| self.current = 0 |
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
| RubyGems Environment: | |
| - RUBYGEMS VERSION: 1.8.11 | |
| - RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [x86_64-linux] | |
| - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p125 | |
| - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby | |
| - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p125/bin | |
| - RUBYGEMS PLATFORMS: | |
| - ruby | |
| - x86_64-linux | |
| - GEM PATHS: |
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
| --- | |
| BUNDLE_BUILD__PG: --with-pg-lib=/usr/pgsql-9.1/lib/ --with-pg-config=/usr/pgsql-9.1/bin/pg_config | |
| BUNDLE_BUILD__DO_POSTGRES: --with-pgsql-server-include=/usr/pgsql-9.1/include/server/ | |
| --with-pgsql-client-dir=/usr/pgsql-9.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
| cd receiver | |
| export GIT_SSL_NO_VERIFY=true | |
| bundle config build.do_postgres --with-pgsql-server-include=/usr/pgsql-9.1/include/server/ --with-pgsql-client-dir=/usr/pgsql-9.1/ | |
| bundle config build.pg --with-pg-lib=/usr/pgsql-9.1/lib/ --with-pg-config=/usr/pgsql-9.1/bin/pg_config | |
| bundle install | |
| cd tests | |
| ruby basic_tests.rb | |
| # at this point, it shows: | |
| # /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in # `require': cannot load such file -- dm-core (LoadError) | |
| # from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' |
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
| (define-prefix-command 'frame-map) | |
| (define-prefix-command 'window-map) | |
| (global-set-key (kbd "<f1>") 'frame-map) | |
| (global-set-key (kbd "<f2>") 'window-map) | |
| (define-key 'frame-map (kbd "RET") 'make-frame-command) | |
| (define-key 'window-map (kbd "RET") 'make-window-command) | |
| (define-key 'frame-map (kbd "b") 'ido-switch-buffer-other-frame) ;; todo: check if ido is active | |
| (define-key 'window-map (kbd "b") 'ido-switch-buffer-other-window) | |
| (define-key 'frame-map (kbd "f") 'ido-find-file-other-frame) | |
| (define-key 'window-map (kbd "f") 'ido-find-file-other-window) |
OlderNewer