Skip to content

Instantly share code, notes, and snippets.

@lfborjas
lfborjas / Dockerfile
Created December 14, 2020 01:00 — forked from TimWSpence/Dockerfile
Optimized multistage Dockerfile for Haskell Stack builds
# Loosely based on https://www.fpcomplete.com/blog/2017/12/building-haskell-apps-with-docker
FROM fpco/stack-build:lts-13.27 as dependencies
RUN mkdir /opt/build
WORKDIR /opt/build
# GHC dynamically links its compilation targets to lib gmp
RUN apt-get update \
&& apt-get download libgmp10
RUN mv libgmp*.deb libgmp.deb
@lfborjas
lfborjas / fun.js
Last active December 14, 2015 08:48 — forked from syntacticsugar/gist:5059926
//The fun solution: using array methods
var ary = [];
for(var i = 1; i <= 1000; i++){ ary.push(i); }
console.log(
ary.filter(function(item){
return (item % 3 == 0 || item % 5 == 0)
}).reduce(function(memo, current){
return memo + current
}, 0)
);
@lfborjas
lfborjas / huffman.py
Created July 24, 2012 02:12 — forked from ryanwitt/huffman.py
silly huffman coding example
import subprocess
import sys
from subprocess import PIPE, Popen
import os
__all__ = (
'build',
'endode',
'decode',
)
@lfborjas
lfborjas / gist:3158818
Created July 22, 2012 07:55 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
events =
events: {}
bind: (topic, handler, context = this) ->
(@events[topic] ||= []).push { handler, context }
trigger: (topic, args...) ->
if @events[topic]?
event.handler.apply event.context, args for event in @events[topic]
@lfborjas
lfborjas / gist:1642349
Created January 19, 2012 20:23 — forked from panicsteve/gist:1641705
Form letter template for acquired startups
Dear soon-to-be-former user,
We've got some fantastic news! Well, it's great news for us anyway. You, on
the other hand, are fucked.
We've just been acquired by:
[ ] Facebook
[ ] Google
[ ] Twitter
@lfborjas
lfborjas / .vimrc
Created July 26, 2011 22:24 — forked from jeresig/.vimrc
VIM Config
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
set nocompatible
set autoindent
set tabstop=2
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
syntax on
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and you're using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
#!/usr/bin/env ruby
%w(rubygems grit json pathname).each{|d| require d}
# Aside from removing Ruby on Rails specific code this is taken verbatim from
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome
# - Ryan Florence (http://ryanflorence.com)
#
# Install this hook to a remote repository with a working tree, when you push
# to it, this hook will reset the head so the files are updated
if ENV['GIT_DIR'] == '.'