Skip to content

Instantly share code, notes, and snippets.

View vic's full-sized avatar
🤮
puke nuke

Victor Borja vic

🤮
puke nuke
View GitHub Profile
@vic
vic / effect-manager-init.elm
Created May 31, 2016 05:30
empty useless effect manager
effect module My where { command = MyCmd } exposing
( init
)
import Task exposing (Task)
import Platform.Cmd exposing (Cmd)
-- Manager
@vic
vic / atl.html
Created December 19, 2013 12:59
<html>
<head>
<script type='text/javascript'>
+(function(undefined){
var Acute = function(){
}
var TEXT_PLACEHOLDER_RE = /\{\{[\w\.]+\}\}/
@vic
vic / search.json
Created November 2, 2013 00:20
foo bar baz
{
"query": {
"bool": {
"must": [
{
"terms": {
"baz_id": [
6
@vic
vic / gist:6136967
Created August 2, 2013 01:57
find_nearest point
function rad(x) {return x*Math.PI/180;}
function find_nearest(my_position, points) {
var lat = my_position[0];
var lng = my_position[1];
var R = 6371; // radius of earth in km
var distances = [];
var closest = null;
for( i=0;i<points.length; i++ ) {
var mlat = points[i][0];
@vic
vic / twitter.js
Created June 18, 2013 13:59
Extracting vine's video url from tweets, from www.antojame.com code.
var $ = require('jquery')
var _ = require('underscore')
var Twitter = require('twitter-api');
var twitter_consumer = {
'consumer_key' : 'XXX',
'consumer_secret' : 'XXX'
}
var twitter_token = {
'access_token_key' : 'XXX',
%title {{title}}
@vic
vic / elasticsearch_spanish_analyzer.yml
Created December 14, 2012 18:48
Copy and paste this fragment at the end of your elasticsearch.yml file. If you're on mac, and installed elasticsearch using brew, this configuration should be at /usr/local/Cellar/elasticsearch/0.19.10/config/elasticsearch.yml
index:
analysis:
analyzer:
spa:
type: custom
tokenizer: standard
filter: [standard, asciifolding, lowercase, stop, snow_spa]
default:
type: custom
tokenizer: standard

.

@vic
vic / example.java
Created September 29, 2015 20:00
Mapping a collection of interfaces
class Target {
List<TargetItem> items;
}
interface TargetItem {}
class TargetItemA implements TargetItem {}
class TargetItemB implements TargetItem {}
class Source {
@vic
vic / fancy.rb
Created August 1, 2011 08:04
Parsing the Fancy Language with KPeg.
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift File.expand_path('../../kpeg/lib', __FILE__)
require 'kpeg'
class Fancy
G = KPeg::Grammar.new
KPeg.compile DATA.read, "Parser", self