Skip to content

Instantly share code, notes, and snippets.

[{"min":5143121003,"max":5143121018},{"min":5143121022,"max":5143121037},{"min":5143121040,"max":5143121050},{"min":5143121053,"max":5143121209},{"min":5143121255,"max":5143121286},{"min":5143121289,"max":5143121299},{"min":5143124700,"max":5143124709},{"min":5143125321,"max":5143125330},{"min":5143127001,"max":5143127014},{"min":5143127095,"max":5143127104},{"min":5143127428,"max":5143127437},{"min":5143127684,"max":5143127700},{"min":5143127709,"max":5143127720},{"min":5143127724,"max":5143127736},{"min":5143127743,"max":5143127763},{"min":5143127787,"max":5143127798},{"min":5143127800,"max":5143127838},{"min":5143127840,"max":5143127855},{"min":5143127857,"max":5143127867},{"min":5143127912,"max":5143127965},{"min":5143127967,"max":5143127976},{"min":5143128101,"max":5143128113},{"min":5143128180,"max":5143128199},{"min":5143128850,"max":5143128869},{"min":5143128895,"max":5143128910},{"min":5143128958,"max":5143129001},{"min":5143129074,"max":5143129089},{"min":5143129114,"max":5143129145},{"min":51431292

Elm 0.16 Migration of Simple App

Once 0.16 installed

Installing my app's packages didn't work

elm package install

I got the following message

import Html exposing (..)
import String exposing (..)
type Dog a = Fido
myFunc: Dog Int -> String
myFunc myDog =
"Wouf Wouf"
main = text (myFunc (Fido))
set makeprg=ruby\ -I\ lib:test:spec\ %
map <Leader>t :w<CR>:silent !clear<CR> :make! %<CR>
@martinos
martinos / echo_server.rb
Last active August 29, 2015 14:17
How to test a cli app
require 'minitest/autorun'
require 'expect'
Thread::abort_on_exception = true
class EchoServer
def initialize(stdin: , stdout:)
@stdin = stdin
@stdout = stdout
end
@martinos
martinos / pre-commit
Created February 20, 2015 15:54
pre-commit hook for forbidding syntax error to be committed
#! /usr/bin/env bash
ruby_files=`git diff --name-only --diff-filter=MA --cached| grep '\.rb$'`
while read -r file; do
result=`grep -rn 'binding\.pry\|debugger' $file`
if [ -n "$result" ]
then
echo "Cannot be commited because: $result ."
@martinos
martinos / rate_limiter
Created December 5, 2014 16:21
Rate limiter in golang
import "time"
rate_per_sec := 10
throttle := time.Tick(1e9 / rate_per_sec)
for req := range requests {
<-throttle // rate limit our Service.Method RPCs
go client.Call("Service.Method", req, ...)
}
@martinos
martinos / designer.html
Created September 1, 2014 17:00
designer
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
from /Users/myusername/.gem/ruby/2.1.0/gems/byebug-2.6.0/lib/byebug.rb:15:in `call'
from /Users/myusername/.gem/ruby/2.1.0/gems/byebug-2.6.0/lib/byebug.rb:15:in `block in <module:Byebug>'
from /Users/myusername/.gem/ruby/2.1.0/gems/byebug-2.6.0/lib/byebug.rb:15:in `map'
from /Users/myusername/.gem/ruby/2.1.0/gems/byebug-2.6.0/lib/byebug.rb:15:in `<module:Byebug>'
from /Users/myusername/.gem/ruby/2.1.0/gems/byebug-2.6.0/lib/byebug.rb:12:in `<top (required)>'
from /Users/myusername/.rubies/2.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/myusername/.rubies/2.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/myusername/.gem/ruby/2.1.0/gems/pry-byebug-1.3.1/lib/pry-byebug/processor.rb:2:in `<top (required)>'
from /Users/myusername/.rubies/2.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/myusername/.rubies/2.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
@martinos
martinos / pre-commit_hook.md
Last active December 29, 2015 14:09
Protect your git repo against debugging code

If you don't want to commit changes that contains debugger or binding.pry into the repo. Add the following code in ~/.git_template/hooks/pre-commit

#! /usr/bin/env bash

ruby_files=`git status --short | grep -v '^D' | awk '{print $2}' | grep '.rb$'`

while read -r file; do

result=grep -rin 'binding.pry\|debugger' $file