Skip to content

Instantly share code, notes, and snippets.

View bravoecho's full-sized avatar

Luca bravoecho

  • UK
  • 10:53 (UTC +01:00)
View GitHub Profile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
~/Downloads/tiger-build ~/dotfiles
apt package index updated less than 60 minutes ago
Reading package lists...
Building dependency tree...
Reading state information...
libjpeg-turbo8-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
// ==UserScript==
// @name UTM param stripper
// @author Paul Irish
// @namespace http://github.com/paulirish
// @version 1.2
// @description Drop the UTM params from a URL when the page loads.
// @extra Cuz you know they're all ugly n shit.
// @include http*://*
// ==/UserScript==
@bravoecho
bravoecho / vim74_lua
Last active August 29, 2015 14:11 — forked from jdewit/vim74_lua
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common
sudo apt-get build-dep vim-gnome
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev mercurial libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev
sudo rm -rf /usr/local/share/vim
sudo rm /usr/bin/vim
@bravoecho
bravoecho / week.rb
Last active August 29, 2015 14:05
Week bitmask / bitarray
require 'set'
class Week
DAYS = %w[Mon Tue Wed Thu Fri Sat Sun]
REVERTED_DAYS = DAYS.reverse
attr_reader :day_bitmask
def self.new(*days)
# spec/spec_helper.rb
module RSpec::Rails::ViewExampleGroup::ExampleMethods
def render_once(*args, &block)
_rendered = self.class.instance_variable_get(:'@__rendered_once__')
_doc = self.class.instance_variable_get(:'@__doc_once__')
_view = self.class.instance_variable_get(:'@__view_once__')
if _rendered && _view
@rendered = _rendered
@bravoecho
bravoecho / coffemix.js.coffee
Created June 26, 2014 10:32
Experiment with coffeescript mixins that change the prototype
class @Moo
class @Mixin
constructor: ->
@boo = 'boo'
@mixin: (klass) ->
klass::mix = @::mix
klass::max = @::max
klass::getBoo = @::getBoo
module Refines
refine Array do
def strictly_increasing?
each_cons(2).all? {|x, y| x < y }
end
end
refine String do
def char_indexes
each_char
@bravoecho
bravoecho / modulator.rb
Created October 24, 2013 11:03
Dynamically build and include a parameterized module. Similar to the Sequel gem inheritance mechanism.
module Awesome
def self.Stuff(thingy)
Module.new do
class_methods = Module.new do
attr_accessor :thingy
end
define_singleton_method :included do |klass|
klass.extend(class_methods)
klass.thingy = thingy
@bravoecho
bravoecho / capture_yield.rb
Created July 29, 2013 12:33
capture a yielded value
class MyClass
def initialize
@thevalue = 42
end
def omg
yield @thevalue
end
end