Skip to content

Instantly share code, notes, and snippets.

@miguelbermudez
miguelbermudez / snippet.js
Created August 8, 2011 21:33
RGB to HSL and RGB to HSV
/**
* From: http://axonflux.com/handy-rgb-to-hsl-and-rgb-to-hsv-color-model-c
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
@miguelbermudez
miguelbermudez / gist:1244106
Created September 27, 2011 01:53 — forked from atduskgreg/gist:1244103
file_locator.rb
puts "Called from: #{File.expand_path(File.dirname("."))}"
puts __FILE__
puts "last: " + File.dirname(__FILE__).split("/").last
puts pwd = File.expand_path(File.dirname(__FILE__))
puts "parent dir:"
ar = pwd.split("/")
puts "/#{ar[ar.length-2]}"
@miguelbermudez
miguelbermudez / style.sass
Created November 4, 2011 06:05 — forked from destroytoday/style.sass
Prevents iOS from changing the font size of paragraphs in landscape
@media only screen and (min-device-width: 320px) and (max-device-width: 1024px)
html
-webkit-text-size-adjust: none
@miguelbermudez
miguelbermudez / app.rb
Created June 4, 2012 20:16
Simple Sinatra App for Reading a SQLite3 DB and outputting JSON
require 'rubygems'
require 'sinatra'
require 'sinatra/json'
require 'data_mapper'
require 'dm-serializer'
require 'haml'
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/george.db")
class Painting
@miguelbermudez
miguelbermudez / svg-path-to-json.py
Created September 28, 2012 18:30 — forked from robflaherty/svg-path-to-json.py
Extract SVG paths and convert to JSON for use with Raphael.js
from xml.dom import minidom
import json
config = {
'svg_file' : 'map.svg',
'js_file' : 'map.js',
'js_var' : 'svgMap'
}
svg = minidom.parse(config['svg_file'])
@miguelbermudez
miguelbermudez / gist:3805422
Created September 29, 2012 23:34 — forked from saetia/gist:1623487
Clean Install – Mountain Lion OS X 10.8
@miguelbermudez
miguelbermudez / gist:4037203
Last active October 12, 2015 13:58 — forked from saetia/gist:1623487
Clean Install – Mountain Lion OS X 10.8
@miguelbermudez
miguelbermudez / Custom.css
Created November 11, 2012 23:12 — forked from wafflesnatcha/Custom.css
Custom.css - WebKit Inspector styles for Google Chrome
/**
* Custom.css
* WebKit Inspector styles for Google Chrome
*
* by Scott Buchanan <[email protected]>
* http://wafflesnatcha.github.com
*
* Fugue Icons by Yusuke Kamiyamane
* http://p.yusukekamiyamane.com
*/
@miguelbermudez
miguelbermudez / Blur.cpp
Created December 5, 2012 05:02 — forked from roxlu/Blur.cpp
Blur shader 2 passing, ping pong attachments
#include <Blur.h>
#define ASSERT_BLUR_SETUP() { \
if(!is_setup) { \
printf("ERROR: not setup.\n"); \
return; \
} \
}
Blur::Blur()
@miguelbermudez
miguelbermudez / uri_parse.rb
Last active October 13, 2015 20:38
Quick Print Parameters from a url
#!/usr/bin/env ruby
# encoding: utf-8
require 'rack'
require "awesome_print"
uri = ARGV[0]
env = Rack::MockRequest.env_for(uri)
req = Rack::Request.new(env)
puts "---\n"