My daughter and I love playing problem-solving/adventure games together. Here's a record of them.
Code.load_file("computation.ex") | |
Code.load_file("aggregator.ex") | |
defmodule AsyncNoLink do | |
def run do | |
:random.seed(:os.timestamp) | |
Task.Supervisor.start_link(name: :task_supervisor) | |
1..10 | |
|> Enum.map(fn(_) -> :random.uniform(1000) - 500 end) |
$ brew update && brew doctor # Repeat, until you've done *all* the Dr. has ordered! | |
$ brew install postgresql # You'll need postgres to do this... you may also need to 'initdb' as well. Google it. | |
$ brew install elixir | |
$ mix local.hex # Answer y to any Qs | |
$ createuser -d postgres # create the default 'postgres' user that Chris McCord seems to like -- I don't create mine w/a pw... | |
# Use the latest Phoenix from here: http://www.phoenixframework.org/docs/installation -- currently this is 1.0.3 | |
# ** Answer y to any Qs ** | |
$ mix archive.install https://github.com/phoenixframework/phoenix/releases/download/v1.0.3/phoenix_new-1.0.3.ez |
# lib/tasks/assets.rake | |
namespace :assets do | |
task :precompile_if_needed do | |
require_relative '../assets_version' | |
next unless AssetsVersion.needs_precompile? | |
Rake::Task["assets:precompile"].invoke | |
AssetsVersion.current.save_to_yaml | |
end |
App.Router.map(function() { | |
this.resource('post', { path: '/posts/:post_id' }); | |
}); | |
App.PostRoute = Ember.Route.extend({ | |
model: function(params) { | |
return this.store.find('post', params.post_id); | |
} | |
}); |
moment.tz.add({ | |
"zones": { | |
"Africa/Algiers": [ | |
"0:12:12 - LMT 1891_2_15_0_1 0:12:12", | |
"0:9:21 - PMT 1911_2_11 0:9:21", | |
"0 Algeria WE%sT 1940_1_25_2", | |
"1 Algeria CE%sT 1946_9_7 1", | |
"0 - WET 1956_0_29", | |
"1 - CET 1963_3_14 1", | |
"0 Algeria WE%sT 1977_9_21 1", |
# Public: A module to be mixed in another class with common methods to index | |
# records in ElasticSearch. | |
# | |
# The host object needs to respond to 'indexed_attributes', which will return | |
# an array of the attributes names to be indexed. | |
# | |
# It's also recommended to override the 'save?' method to make sure only | |
# records that match some specifications are indexed. | |
# | |
# The type used for the ElasticSearch index will be extracted from the name of |
-- gets all fields from a hash as a dictionary | |
local hgetall = function (key) | |
local bulk = redis.call('HGETALL', key) | |
local result = {} | |
local nextkey | |
for i, v in ipairs(bulk) do | |
if i % 2 == 1 then | |
nextkey = v | |
else | |
result[nextkey] = v |
class TracePoint | |
class Middleware | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
stats = {} | |
trace = TracePoint.new(:call) do |tp| |
"I am a freelance Ruby and Rails developer". When I talk with my geek friends, everyone understands what I do and they have a reasonable understanding of how I spend my day. But sometimes, less technical people ask me what I do for a living and then I tend to dumb down the answer: "I am a programmer, I usually build websites.". Oh -they say- my nephew also make websites, he even built me a blog in Blogger.
Err... yes, but that hardly has anything to do with what I do for a living.
There are many different kinds of websites, built with different technologies, and depending on the site and the technology used to build it, they are made by one kind of professional or another. The craft of building a website comprises many different disciplines, and professionals usually specialize in just one part of the process. Although I do many different things, my specialization is mainly programming dynamic websites using Ruby and Rails.
In this article I want to