Skip to content

Instantly share code, notes, and snippets.

View gonz's full-sized avatar

Gonz Saavedra gonz

  • Montevideo, Uruguay
View GitHub Profile
@gonz
gonz / google_maps_markers.js
Created December 1, 2010 21:06
Filter/group google maps markers
{# Map #}
<script type="text/javascript">
var map = new google.maps.Map(document.getElementById("map"), {
zoom: 6,
center: new google.maps.LatLng(-32.574592,-55.20605),
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
scrollwheel: false,
streetViewControl: false,
mapTypeId: google.maps.MapTypeId.TERRAIN
require 'net/http'
require 'uri'
#
#url = 'http://www.amazon.com/gp/product/B004HFS6Z0/ref=s9_simh_gw_p349_d0_i4?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=1J7QTMKWJXARDQJ77VXD&pf_rd_t=101&pf_rd_p=470938631&pf_rd_i=507846'
def fetch(url)
#options.merge!(config[:http]) unless config[:http].nil?
while true do
uri = URI.parse url
gonz@bamboo:~ > git clone git://github.com/maccman/juggernaut.git
Cloning into juggernaut...
remote: Counting objects: 558, done.
remote: Compressing objects: 100% (258/258), done.
remote: Total 558 (delta 309), reused 481 (delta 255)
Receiving objects: 100% (558/558), 576.74 KiB | 135 KiB/s, done.
Resolving deltas: 100% (309/309), done.
gonz@bamboo:~ > cd juggernaut
diff --git a/app/js/app.js b/app/js/app.js
index c7f8248..0dfc712 100644
--- a/app/js/app.js
+++ b/app/js/app.js
@@ -45,9 +45,24 @@ var HealthyFamily = Ext.extend(Ext.Application, {
*
* Returns nothing
*/
- show: function(obj) {
- this.views.activePanel.items.clear();
@gonz
gonz / gist:1686815
Created January 27, 2012 03:28
T9 python
import re, sys
keys = ('abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz')
m = dict((l, str(n)) for n, letters in enumerate(keys, start=2) for l in letters)
data, ocurrences = {}, {}
wmatch = re.compile('[^a-z]+')
def learn(word):
num = ''.join(m[c] for c in word)
for i in xrange(1, len(word) + 1):
@gonz
gonz / gist:2007820
Created March 9, 2012 18:09
Set/Array union/intersection benchmark
require 'benchmark'
require 'set'
n = 50000
m = 5000
t = 100
r1 = (1..n).step(3)
r2 = (1..m).step(2)
s1 = Set.new(r1)
@gonz
gonz / gist:2242193
Created March 29, 2012 19:05
Steaming test
TIMER module_need() : 0.136 ms - Total 0.136 ms / 1 intvls (Avg 0.136 ms)
removing module "float32_mixer"
main debug: looking for audio mixer module: 3 candidates
main debug: using audio mixer module "float32_mixer"
main debug: TIMER module_need() : 0.146 ms - Total 0.146 ms / 1 intvls (Avg 0.146 ms)
main debug: removing module "float32_mixer"
main debug: looking for audio mixer module: 3 candidates
main debug: using audio mixer module "float32_mixer"
main debug: TIMER module_need() : 0.143 ms - Total 0.143 ms / 1 intvls (Avg 0.143 ms)
main debug: removing module "float32_mixer"
@gonz
gonz / render.rb
Created May 11, 2012 17:16 — forked from tizoc/render.rb
class MyRender << Fiasco::Render
def render(name, locals = {})
if ENV['RACK_ENV'] == 'development' && @templates[name]
@compiled.delete(name)
declare(name, @templates[name].filename)
end
super(name, locals)
end
end
ZENCODER_API_KEY='*********' ./zctest.rb
@gonz
gonz / splited.py
Created December 7, 2012 19:09
wtform
from flask.ext.wtf import (Form, TextField, PasswordField, Required,
Email, BooleanField, EqualTo)
from prism.models.user import User
from sqlalchemy import or_
class RegistrationForm(Form):
username = TextField('Username',
validators=[Required()])
password = PasswordField('Password', validators=[Required()])