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
-module(test_gist). | |
-export([test_func/0]). | |
-export([test_recursion/2]). | |
test_func() -> | |
test_recursion(1, 6). | |
test_recursion(X, N) -> | |
if | |
N > 0 -> |
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
-module(contact_model). | |
-behaviour(model). | |
-include("contact.hrl"). | |
description() -> | |
[ {rotate, 5}, {ensure, 2} ]. | |
-define(CONTACTS_PERIOD, (1000000*60*60*24*30) ). |
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
-module(contacts_model). | |
-behaviour(model). | |
-export([parent_models/0,new/1,handle/3]). | |
-include("contacts.hrl"). | |
-define(CONTACTS_PERIOD, (1000000*60*60*24*30) ). | |
-define(DB_TIMOUT, 10000 ). | |
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
% a_model.erl | |
-module(a_model). | |
-export([init/1,handle/2]). | |
-behaviour(model). | |
init({X,Y}) -> | |
{ok,{X,Y}}. |
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
-module(model). | |
-export([new/2,behaviour_info/1, super/2, call/2, state/1, call/3]). | |
behaviour_info(callbacks) -> [{init,1},{handle,2}]. | |
call_stack(N) -> | |
{'EXIT', {_Error, CallStack}} = (catch 1 = 2), | |
lists:nthtail(N, tl(CallStack)). | |
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
-module(contact_model). | |
-behaviour(model). | |
-export([init/1,handle/2]). | |
-include("contacts.hrl"). | |
-define(CONTACTS_PERIOD, (1000000*60*60*24*30) ). | |
-define(DB_TIMOUT, 10000 ). | |
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
-module(contacts). | |
-export([resources/0, contacts/2]). | |
-behaviour(controller). | |
resources() -> | |
[ resource:new([ | |
{path, [{users,int}, {contacts,int}]}, | |
{formats, [json]}, |
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 'activeresource' | |
require 'active_support' | |
class Contact < ActiveResource::Base | |
self.site = "http://openmsg:8890" | |
self.format = :json | |
self.prefix = "/msg/users/:user_id/" | |
self.primary_key = "contact_id" | |
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
#pp | |
#!/usr/bin/perl | |
use Data::Dumper; | |
no strict; | |
no warnings "all"; | |
$cmd = shift @ARGV; | |
while(<>) { | |
chomp; | |
print( $_, "\n" ) if eval $cmd; |
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
Element.addMethods({ | |
png_fix: function(el) { | |
var el = $(el); | |
var pos = navigator.userAgent.indexOf("MSIE "); | |
if (!(Prototype.Browser.IE && el.match('img') && el.src.include('png')) || pos == -1 ) return el; | |
var version = navigator.userAgent.substring(pos + 5); | |
if (! (((version.indexOf("5.5") == 0) || (version.indexOf("6") == 0)) && (navigator.platform == ("Win32"))) ) return el; |
OlderNewer