This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
run() -> | |
Pid = spawn(fun ping/0), | |
Pid ! self(), | |
receive | |
pong -> ok | |
end. | |
ping() -> | |
receive | |
From -> From ! pong | |
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bcrypt' | |
require 'digest/md5' | |
require 'yaml' | |
#todo | |
# load schema.rb | |
# t.string "username", :limit => 30 | |
# t.string "email" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
990: | |
:updated_at: 2011-02-03 15:17:10.704334 +00:00 | |
:email: archpresbytery@gmail.com | |
:karma: 5 | |
:password_salt: $2a$10$31sLwM64th6X07yLN5nw/e | |
:sign_in_count: 2 | |
:password_hash: $2a$10$31sLwM64th6X07yLN5nw/eK8rzfBn8ofFEbrve8dU9OiwKmmaxbd2 | |
:sign_in_failed: 2 | |
:reset_password_token: asd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITHOUT_PTHREADS= yes | |
.if defined(WITHOUT_PTHREADS) | |
CONFIGURE_ARGS+=--disable-pthread | |
PKGNAMESUFFIX:= ${PKGNAMESUFFIX}+nopthreads | |
.else | |
LDFLAGS+= ${PTHREAD_LIBS} | |
CONFIGURE_ARGS+=--disable-pthread | |
.endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nohup::Application.routes.draw do | |
namespace "admin" do | |
get "users/:id/edit" => "users#edit" | |
get "users/:id" => "users#show" | |
get "users" => "users#index" | |
put "users" => "users#index" | |
#resources :comments, :only => [:create, :destroy] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env ruby | |
silicates = Hash.new { | |
|h, k| h[k] = Hash.new | |
} | |
silicates[:mineral0]["ruby"] = "String + red" | |
silicates[:mineral1]["ruby"] = "String + blue" | |
silicates[:mineral2][:ruby] = "Symbol + green" | |
silicates[:mineral3][:ruby] = "Symbol + black" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-type hostname() :: atom() | string(). | |
-type ip4_address() :: {0..255,0..255,0..255,0..255}. | |
-type ip6_address() :: {0..65535,0..65535,0..65535,0..65535, | |
0..65535,0..65535,0..65535,0..65535}. | |
-type ip_address() :: ip4_address() | ip6_address(). | |
-type ip_port() :: 0..65535. | |
-record(hostent, | |
{ | |
h_name :: hostname(), %% offical name of host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-spec map(fun((D) -> R), [D]) -> [R]. | |
map(F, [H|T]) -> | |
[F(H)|map(F, T)]; | |
map(F, []) when is_function(F, 1) -> []. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{atomic, Result} = mnesia:transaction(Fun) | |
case Result of [] -> undefined [Rec] -> Rec#rec.prop end. | |
%% http://www.erlang.org/doc/man/mnesia.html#transaction-2 | |
add_family({family, F, M, Children}) -> | |
ChildOids = lists:map(fun oid/1, Children), | |
Trans = fun() -> | |
mnesia:write(F#person{children = ChildOids}, | |
mnesia:write(M#person{children = ChildOids}, | |
Write = fun(Child) -> mnesia:write(Child) end, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class X | |
def initialize | |
begin | |
@yaml_hash = YAML::load(File.read("xyz.yml")) | |
rescue => e | |
puts "An error generated during opening the xyz.yml" | |
puts e | |
end | |
end | |
end |
OlderNewer