Skip to content

Instantly share code, notes, and snippets.

module Response where
import List
import Effects exposing (Effects)
import Task exposing (Task)
import Result exposing (Result)
type alias Response model action = (model, Effects action)
withModel : Effects a -> m -> Response m a
@esad
esad / .jazzy.yaml
Created February 4, 2016 16:41
Jazzy stray struct example
module: StrayStruct
author: Esad Hajdarevic
author_url: http://github.com/esad
objc: true
clean: true
framework_root: .
umbrella_header: foo.h
sdk: iphonesimulator
custom_categories:
- name: Bravo Struct Hits 1999
birthday(5,15). birthday(5,16). birthday(5,19).
birthday(6,17). birthday(6,18).
birthday(7,14). birthday(7,16).
birthday(8,14). birthday(8,15). birthday(8,17).
countd(D,C) :- #count{X: birthday(X,D) } = C, birthday(_,D).
countm(M,C) :- #count{X: birthday(M,X) } = C, birthday(M,_).
% Satz 1
result(M,D) :- birthday(M,D), countm(M,C1), countd(D,C2), C1 > 1, C2 > 1.
use_module(library(date)).
event(asleep).
event(wokeup).
eventdb(Ts,X,I) :- event(X), call(X,Y), parse_time(Y,Ts), aggregate(min(IArg), eventdb(_,_,IArg), IMin), I=IMin+1.
asleep('2015-03-28 23:00').
asleep('2015-03-28 22:00').
wokeup('2015-03-28 02:00').
app1/Gemfile:
gem 'a', path: '../gems/a'
gem 'b', path: '../gems/b'
app2/Gemfile:
gem 'a', path: '../gems/a'
gem 'b', path: '../gems/b'
@esad
esad / gist:1311719
Created October 25, 2011 07:33
Esad's whole foods diet
Eat as much as you want.
Whole foods.
Protein rich, low fat.
No preservatives except salt.
No spices.
No industrially processed food, except for packaging (i.e. canned tuna).
Low intake of dairy products.
Eggs without yolk.
Only non-carbonated water and juice made directly from fruit in front of your eyes.
Only pure, freshly grind espresso. Two cups/day max.
@esad
esad / gist:1015087
Created June 8, 2011 18:59
Prefix routes in sinatra
# Prefix routes with /api/v1
%w(get post head options put).each do |method|
eval <<-RUBY
def self.#{method}(path, opts={}, &bk)
super("/api/v1"+path,opts,&bk)
end
RUBY
end
var Store = Brick.Model("Store");
var Chain = Brick.Model("Chain").hasMany(Store,{url:"/chains/<%= id %>/stores.json"});
var Country = Brick.Model("Country").hasMany(Chain);
esad@gagarin:~/Projects/appscape/vapor(master)$ irb
irb(main):001:0> gem 'actionpack', '3.0.0'
=> true
irb(main):002:0> require 'action_view/helpers/date_helper'
NameError: uninitialized constant ActionView::Helpers::TagHelper::ERB
from /Library/Ruby/Gems/1.8/gems/actionpack-3.0.0/lib/action_view/helpers/tag_helper.rb:10
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in `require'
from /Library/Ruby/Gems/1.8/gems/actionpack-3.0.0/lib/action_view/helpers/date_helper.rb:2
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in `gem_original_require'
require File.join(File.dirname(__FILE__),'spec_helper')
def parse(str)
Timespan.parse(str).map {|span| [span.day_of_week,span.from_h,span.from_m,span.to_h,span.to_m] }
end
mon,tue,wed,thu,fri,sat,sun = 1,2,3,4,5,6,7
describe Timespan do
it 'parses single day/single hourspan' do