Skip to content

Instantly share code, notes, and snippets.

View albertico's full-sized avatar

Alberto Colón Viera albertico

  • Washington, DC / Puerto Rico
View GitHub Profile
@Visuelle-Musik
Visuelle-Musik / aVisualSynth44.rb
Created December 8, 2009 20:41
MIDI driven "VJ"-application in ruby-processing, 'manual' see "visualSynthSettings14.rb"
# --- parameters to be set in ./data/java_args.txt ---
# -Xms256m -Xmx256m # Heap at least 256 MB
# -Djna.library.path="/ruby-processing/library/gsvideo/library/gstreamer/win" # optional for future video extension...
require "jrMidiVsynth22" # class JRmidi for basic MIDI I/O in JRuby, adapt your MIDI-ports here if necessary
SETTINGS = "visualSynthSettings14" # contains changable settings for "which function to call" by modifier-keys
# === helper functions === (map internal representation of layers to external for "print-out"
class Range
def inspect_plus_one
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@nu7hatch
nu7hatch / Gemfile
Created August 4, 2010 09:32
Padrino authentication with Warden
# ...
gem 'padrino-warden', :git => "git://github.com/zmack/padrino-warden.git"
gem 'authtools'
@ipoval
ipoval / http_authentication
Created February 23, 2011 17:51
Http basic authentication for padrino
module HttpAuthentication
module Basic
def authenticate_or_request_with_http_basic(realm = 'Application')
authenticate_with_http_basic || request_http_basic_authentication(realm)
end
def authenticate_with_http_basic
if auth_str = request.env['HTTP_AUTHORIZATION']
return 'login:password' == ActiveSupport::Base64.decode64(auth_str.sub(/^Basic\s+/, ''))
end
@MrJaba
MrJaba / visualizer.rb
Created March 9, 2011 13:20
A Processing Music Visualizer
# Visualizer
class Visualizer < Processing::App
load_library "minim" #Java sound library included with processing. load_library is provided by ruby-processing
import "ddf.minim"
import "ddf.minim.analysis"
def setup
smooth
@igrigorik
igrigorik / rack_routes.rb
Created March 29, 2011 04:17
Goliath + http_router.rb
require 'goliath'
require 'http_router'
# https://github.com/joshbuddy/http_router
HttpRouter::Rack.override_rack_builder!
class RackRoutes < Goliath::API
map('/get/:id') do |env|
[200, {'Content-type' => 'text/plain'}, ["My id is #{env['router.params'][:id]}\n"]]
end
@ryanj
ryanj / dabblet.css
Created December 16, 2011 19:29
A Sample CSS upgrade for Eventbrite's default event pages
/**
* A Sample CSS upgrade for Eventbrite's default event pages
*/
/*-----------------------------------------------------------------
Theme: No Compromises
By: The Eventbrite Design Team
To use this theme follow these five easy steps.
1) Login to your Eventbrite account. If you don't have one visit
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
@dodeja
dodeja / gist:1691624
Created January 27, 2012 23:44
Warden HTTP Basic Auth Strategy for Padrino
# I am using this for an API. So auth key is passed as user name.
Warden::Strategies.add(:basic) do
def auth
@auth ||= Rack::Auth::Basic::Request.new(env)
end
def store?
false
@jfarmer
jfarmer / 01-truthy-and-falsey-ruby.md
Last active April 16, 2024 03:40
True and False vs. "Truthy" and "Falsey" (or "Falsy") in Ruby, Python, and JavaScript

true and false vs. "truthy" and "falsey" (or "falsy") in Ruby, Python, and JavaScript

Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).

This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.

If you want to use or share this material, please see the license file, below.

Update