Skip to content

Instantly share code, notes, and snippets.

View halan's full-sized avatar
🛹

Halan Pinheiro halan

🛹
View GitHub Profile
@coreyhaines
coreyhaines / Animation.elm
Last active June 19, 2017 14:48
Animation support library
module Animation exposing (..)
import Task
import Process
import Time exposing (Time, millisecond)
type Animation state
= Setup state
| Animate state
@yang-wei
yang-wei / decode.md
Last active April 2, 2024 20:18
Elm Json.Decode tutorial and cheatsheet

When receiving JSON data from other resources(server API etc), we need Json.Decode to convert the JSON values into Elm values. This gist let you quickly learn how to do that.

I like to follow working example code so this is how the boilerplate will look like:

import Graphics.Element exposing (Element, show)
import Task exposing (Task, andThen)
import Json.Decode exposing (Decoder, int, string, object3, (:=))

import Http
let map = (fn,[head, ...tail]) => head === undefined
? []
: [fn(head), ...map(fn,tail)]
console.log("map(x=>x+1,[1,2,3,4]) :",map(x=>x+1,[1,2,3,4]))
let filter = (predicate, [head, ...tail]) => head === undefined
? []
: predicate(head)
? [head, ...filter(predicate, tail)]
@jbum
jbum / dreamImage.py
Created July 12, 2015 20:39
jbum's DeepDream scripts
# DreamImage.py - parameterized deepdream with support for multiple models,
# auto-image-scaling, guided dreaming and kaleido mode (self-guided).
# Jim Bumgardner 7-12-15
# this assumes the deploy file is called 'deploy.prototxt' - you may need
# to rename it if using a different model such as googlenet_places205.
# sample invocations that produce nice results:
# python dreamImage.py -i $1.jpg -model ../../caffe/models/googlenet_places205 -end inception_3a/output -iter 20 -octaves 5 -o $1_m3a.jpg
# python dreamImage.py -i $1.jpg -model ../../caffe/models/googlenet_places205 -end inception_3b/output -iter 20 -octaves 5 -o $1_m3b.jpg
@brennovich
brennovich / .vimrc
Last active December 15, 2015 19:19
Minimal `.vimrc` using [Vundle](https://github.com/gmarik/vundle).
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
let mapleader=','
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
@gutenye
gutenye / ember-with-middleman.md
Last active December 10, 2015 01:58
Write Ember.js App With Middleman

I. Create a Middleman project with middleman-ember-template

$ middleman init hello --template=ember

II. Install ember.js package

$ bower install ember
@stevenharman
stevenharman / _compose_query_objects.md
Last active December 19, 2017 21:33
Build compose-able query objects by delaying query execution and delegating to the underlying `ActiveRecord::Relation` for everything else. #ruby #rails

Compose-able Query Objects in Rails

Example usage:

old_accounts = Account.where("created_at < ?", 1.month.ago)
old_abandoned_trials = AbandonedTrialQuery.new(old_accounts)

old_abandoned_trials.find_each do |account|
 account.send_offer_for_support
@hauleth
hauleth / .vimrc
Created July 4, 2012 18:39
My .vimrc
" Infect Vim with pathogen
call pathogen#infect()
" Use ZSH as Vim shell to get rid of strange errors
set shell=/bin/zsh
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 15, 2024 09:51
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@pzol
pzol / README.md
Created June 5, 2012 07:23
RVM + Puma + Ubuntu

Running Puma on Nginx

I use the latest Puma v1.4.0 from rubygems.

Make sure you have nginx installed with these options:

>/opt/nginx/sbin/nginx -V
nginx version: nginx/1.0.15

built by gcc 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)