Skip to content

Instantly share code, notes, and snippets.


srdjan srdjan

View GitHub Profile
srdjan / gist:1300262
Created Oct 20, 2011
angularjs mvctodo app with coffeescript controller
View gist:1300262
@TodoController = () ->
@todos = []
@newTodo = ""
@addTodo = () ->
if @newTodo.length > 0
@todos.push( { content: @newTodo, done: false, editing: false } )
@newTodo = ""
@editTodo = (todo) ->
srdjan /
Created Nov 1, 2011 — forked from sdiehl/
Observer Pattern in Coffeescript
class Observer
bind : (event, fn) ->
this._events ||= {}
this._events[event] ||= []
unbind: (event, fn) ->
@_events ||= {}
srdjan / xhr.js
Created Nov 3, 2011 — forked from mythz/xhr.js
Standalone jQuery-like Ajax Client
View xhr.js
//Adds $.xhr and jQuery-like $.ajax methods to the prescribed namespace.
//Inspired from David Flanagans excellent cross-platform utils
//Includes underscore.js _.each and _.extend methods
//modified to behave like jQuery's $.ajax(), not complete.
(function($) {
var win=window, xhrs = [
function () { return new XMLHttpRequest(); },
function () { return new ActiveXObject("Microsoft.XMLHTTP"); },
function () { return new ActiveXObject("MSXML2.XMLHTTP.3.0"); },
function () { return new ActiveXObject("MSXML2.XMLHTTP"); }
srdjan /
Created Nov 14, 2011 — forked from madrobby/
Backbone i18n with CoffeeScript
window.t = (id, vars = {}) ->
template = i18n[__locale][id] or i18n['en'][id] or "(?) #{id}"
_.template(template, vars)
# yes, that's it
srdjan / dnsd.rb
Created Feb 12, 2012 — forked from peterc/dnsd.rb
Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
View dnsd.rb
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
# MIT license
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See for protocol guidance
# * All records get the same TTL
class App extends Batman.App
class App.Todo extends Batman.Model
@encode('body', 'isDone')
body: ''
View gist:2039228
class Entity extends Batman.Model
@field: (name, options) ->
@fields ?= {}
@fields[name] = options || {}
constructor: (attributes) ->
@attributes = {}
for name, options of @constructor.fields
@attributes['encode'] = true
srdjan /
Created Jul 10, 2012 — forked from sadache/
Is socket.push(bytes) all what you need to program Realtime Web apps?

Is socket.push(bytes) all what you need to program Realtime Web apps?

One of the goals of Play2 architecture is to provide a programming model for what is called Realtime Web Applications.

Realtime Web Applications

Realtime Web Applications are applications making use of Websockets, Server Sent Events, Comet or other protocols offering/simulating an open socket between the browser and the server for continuous communication. Basically, these applications offer to users delivery of information as it is published without having the user periodically pinging the service.

There are quite a few web frameworks that target the development of this type of applications. Mostly, however, the solution is by providing an API that allows developers to push/receive messages from/to an open channel, something like:

srdjan / build.fsx
Created Dec 11, 2012
Simple FAKE CI script
View build.fsx
#r @"../_tools/FAKE/FakeLib.dll"
#r @"../_tools/FAKE/MyFakeTasks.dll"
open Fake
open System.IO
open MyFakeTasks
let author = ["Srdjan Strbanovic"]
let release = @".\WinService\bin\release"
let debug = @".\WinService\bin\debug"
srdjan / gist:4260421
Created Dec 11, 2012
Custom Git task for FAKE
View gist:4260421
using System;
using System.Diagnostics;
using System.Linq;
namespace MyFakeTasks
public class GitTasks
public static int Pull(string workingDirectory)
You can’t perform that action at this time.