Skip to content

Instantly share code, notes, and snippets.

@jyr
jyr / vim.rb
Last active December 18, 2015 00:09 — forked from mgrouchy/vim.rb
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'https://vim.googlecode.com/hg/', :revision => '6c318419e331'
version '7.3.515'
def features; %w(tiny small normal big huge) end
def interp; %w(lua mzscheme perl python python3 tcl ruby) end
@jyr
jyr / my.cnf
Last active March 19, 2016 03:20
my.cnf on MNPP
# Example MySQL config file for small systems.
#
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
@jyr
jyr / Vagrantfile
Created April 9, 2013 16:14
My Vagrantfile for drupal
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "nuperty-drupal"
@jyr
jyr / alarm.sh
Created December 21, 2012 19:07
YOUR_ISP=www.google.com
while :
do
ping -t 2 -o -c 1 $YOUR_ISP || open alarm.wav
sleep 1
done
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "nuperty"
Monquiro.Views ||= {}
class Monquiro.Views.GoogleMapView extends Backbone.View
# A Backbone View always holds a div element in his @el variables.
id: 'map' # Sets the id of the @el div
initialize: () ->
$(@el).css('width','100%') # You can access the @el div with jQuery even if it's not yet on the document.
$(@el).css('height','600px')
@map = null
@jyr
jyr / map.js
Created October 7, 2012 21:39
example backbone render map
Backbone.js Events not firing
MapModalView = Backbone.View.extend({
events: {
'click #closeMapModal': 'closeModal',
'click #modal_streetview': 'renderStreet'
},
initialize: function(){
this.el = $('.modal_box');
this.template = _.template($('#map-modal-template').html());
_.bindAll(this, 'renderMap', 'renderPin');
@jyr
jyr / psqlfix.txt
Last active April 25, 2024 21:29
Change postgres default template0 to UTF8 encoding
http://blog.desgrange.net/2012/06/05/caldav-carddav-debian-davical-ios-ical.html
mike@rbci:~$ psql -U postgres
psql (9.0.3)
Type "help" for help.
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
UPDATE 1
postgres=# \c template0
You are now connected to database "template0".
@jyr
jyr / to_csv.rb
Created September 20, 2012 22:53
cvs generator
#!/usr/local/bin/ruby -w
require "csv"
CSV_FILE_PATH = File.join(File.dirname(__FILE__), "input.csv")
CSV.foreach(CSV_FILE_PATH) do |row|
puts "ROW -- #{row}"
end
CSV_FILE_PATH_OUT = File.join(File.dirname(__FILE__), "output.csv")
@jyr
jyr / array_to_hash.rb
Created August 17, 2012 02:38
convert array to hash
1.9.2p318 :001 > a= ['a','b','c','d']
=> ["a", "b", "c", "d"]
1.9.2p318 :002 > b = [1,2,3,4]
=> [1, 2, 3, 4]
1.9.2p318 :003 > c = a.zip(b).flatten.compact
=> ["a", 1, "b", 2, "c", 3, "d", 4]
1.9.2p318 :004 > h = Hash[*c.flatten]
=> {"a"=>1, "b"=>2, "c"=>3, "d"=>4}