Skip to content

Instantly share code, notes, and snippets.

View savonarola's full-sized avatar
🏠
Working from home

Ilia Averianov savonarola

🏠
Working from home
View GitHub Profile
-module(test_gist).
-export([test_func/0]).
-export([test_recursion/2]).
test_func() ->
test_recursion(1, 6).
test_recursion(X, N) ->
if
N > 0 ->
-module(contact_model).
-behaviour(model).
-include("contact.hrl").
description() ->
[ {rotate, 5}, {ensure, 2} ].
-define(CONTACTS_PERIOD, (1000000*60*60*24*30) ).
-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 ).
% a_model.erl
-module(a_model).
-export([init/1,handle/2]).
-behaviour(model).
init({X,Y}) ->
{ok,{X,Y}}.
-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)).
-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 ).
-module(contacts).
-export([resources/0, contacts/2]).
-behaviour(controller).
resources() ->
[ resource:new([
{path, [{users,int}, {contacts,int}]},
{formats, [json]},
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"
#pp
#!/usr/bin/perl
use Data::Dumper;
no strict;
no warnings "all";
$cmd = shift @ARGV;
while(<>) {
chomp;
print( $_, "\n" ) if eval $cmd;
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;