Skip to content

Instantly share code, notes, and snippets.

@pirelenito
pirelenito / enablePropTypesCheck.js
Created August 14, 2018 10:20
Enable prop-type checks in preact
/**
* Custom implementation that enables PropTypes checks in preact
*
* Based on:
* - https://github.com/developit/preact-compat
* - https://github.com/developit/preact/issues/902#issuecomment-334507942
*/
import { options, Component } from 'preact'
import PropTypes from 'prop-types'
@pirelenito
pirelenito / bob.exs
Created August 12, 2015 18:11
Elixir Meetup Hacknight 12-08-2015
defmodule Teenager do
def hey(input) do
cond do
silence? input ->
"Fine. Be that way!"
question? input ->
"Sure."
yeling?(input) and !nonsense?(input) ->
"Whoa, chill out!"
true -> "Whatever."
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "../triforce-packer/triforce_vmware.box"
end
@pirelenito
pirelenito / gist:5e2e80eba4ad710599ca
Created October 29, 2014 15:04
Vagrant up error on CoreOS
Bringing machine 'default' up with 'vmware_fusion' provider...
==> default: Verifying vmnet devices are healthy...
==> default: Preparing network adapters...
==> default: Starting the VMware VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 172.16.31.183:22
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
@pirelenito
pirelenito / amd_define.sublime-snippet
Created September 9, 2013 00:11
Sublime Text 2 AMD module definition snippet
<snippet>
<content><![CDATA[
define([${1}
],
function (${2}) {
${3}
});
]]></content>
<tabTrigger>def</tabTrigger>
@pirelenito
pirelenito / development.rb
Created September 25, 2011 23:03
Fast mongoid single collection inheritance with Rails 3.1 Asset Pipeline.
# Allows Mongoid's single collection inheritance to work with the Asset pipeline
# without enabling model preloading, which greatly reduces the performance of
# the application in development mode.
# see: http://martinciu.com/2011/06/rails-3-1-and-slow-asset-pipeline.html
# see: http://groups.google.com/group/mongoid/browse_thread/thread/3d37977a321dc56d?pli=1
# see: http://mongoid.org/docs/rails/railties.html
config.to_prepare do
Dir["#{Rails.root}/app/models/*.rb"].each {|file| require file }
end
@pirelenito
pirelenito / gist:908126
Created April 7, 2011 16:21
Getting started with RGeo
require 'rgeo'
# factory = RGeo::Geos.factory()
# factory = RGeo::Geographic.spherical_factory()
factory = RGeo::Geographic.simple_mercator_factory()
p1 = factory.point 0, 0
p2 = factory.point 0, 2
p3 = factory.point 2, 2
p4 = factory.point 2, 0