Skip to content

Instantly share code, notes, and snippets.

@xsurge83
xsurge83 / TodosController
Created March 21, 2012 12:55
Batmanjs Todo Controller
class TodosController extends Batman.Controller
index: () ->
@set('todo', new Todo())
@render(false)
create: () =>
@todo.save(() => @set('todo', new Todo))
# clean checked todo items.
clean: () ->
todos = TodoApp.get('Todo.all')
@xsurge83
xsurge83 / test.cs
Created September 26, 2012 15:57
Regex to replace password
using NUnit.Framework;
namespace REGEX.TESTS
{
[TestFixture]
public class RegexTests
{
[Test]
public void Regex()
@xsurge83
xsurge83 / Program.cs
Created November 21, 2012 14:48
Power of Dynamics
using System;
using System.Collections.Generic;
using System.Dynamic;
namespace Demo
{
class Program
{
static void Main()
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">Kay's Life</tspan>
</label>
<actor t="translate(131,49)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59">
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">Miami Life</tspan>
</label>
<actor t="translate(131,49)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59">
@xsurge83
xsurge83 / gist:5032128
Last active December 14, 2015 04:59
Private and public methods
class MyClass2
self = 'default'
console.log 'invoked once invoke me once per load'
constructor: ->
my21 = new MyClass2();
my22 = new MyClass2();
@xsurge83
xsurge83 / mapView
Last active December 14, 2015 18:09
Google Maps View
(function(exports, $) {
var MapView;
MapView = (function() {
function MapView(mapId, defaultLocation, map) {
self = this;
var location = BrowserUtils.getParamFromQuery('query');
if (!location) {
@xsurge83
xsurge83 / gist:5351458
Created April 10, 2013 03:12
one liner : add to array
(r || (r = [])).push('d')
@xsurge83
xsurge83 / oop.coffee
Last active December 16, 2015 02:09
OOP Private and Public Member
MyClass= ->
prVar = 'private'
prMethod1 = ->
console.log 'prMethod'
self.pubMethod2()
public_members =
pubVar : 'public'
pubMethod1: ->
console.log 'pubMethod1'
# Module pattern with cached functions
FooFunction = ->
log "foo"
BarFunction = ->
log "bar"
Klass3 = ->
foo: FooFunction
bar: BarFunction