Skip to content

Instantly share code, notes, and snippets.

View gurdasnijor's full-sized avatar
🤠

Gurdas Nijor gurdasnijor

🤠
View GitHub Profile
@jonnyreeves
jonnyreeves / testrunner.html
Created June 2, 2012 13:32
Unit Testing Promises with Sinon.js
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" />
<!-- when.js Promises implementation -->
<script src="https://raw.github.com/cujojs/when/master/when.js"></script>
<!-- Unit testing and mocking framework -->
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script>
@OllyHodgson
OllyHodgson / Regex for removing SharePoint Designer 2010 specific markup
Created August 29, 2012 10:49
Opening an .aspx in SharePoint Designer 2010 litters it with SPD-specific markup. This removes most (if not all) of it. Note I run this one in Sublime Text 2, other editors might need some tweaking. Also note the leading space.
__[A-Za-z\-\:]*="[^"]*"
@insin
insin / oohooh-aahaah.js
Created September 4, 2012 10:47
Backbone.Collection.prototype.move
/**
* Moves a model to the given index, if different from its current index. Handy
* for shuffling models about after they've been pulled into a new position via
* drag and drop.
*/
Backbone.Collection.prototype.move = function(model, toIndex) {
var fromIndex = this.indexOf(model)
if (fromIndex == -1) {
throw new Error("Can't move a model that's not in the collection")
}
@radiosilence
radiosilence / gist:4040553
Created November 8, 2012 18:19
RequireJS with Zurb Foundation
requirejs.config({
shim: {
'foundation/jquery.foundation.topbar': {
deps: ['jquery'],
},
'foundation/jquery.cookie': {
deps: ['jquery']
},
'foundation/jquery.event.move': {
deps: ['jquery']
@iros
iros / storyboard.example.js
Created November 9, 2012 17:26
Miso Storyboard Example
var interactive = new Miso.Storyboard({
// our initial state will be loading
initial : 'loading',
scenes : {
loading: {
enter : function() {
// show that we are in a loading state
$('#loading').show();
@JonCanning
JonCanning / gist:5120091
Created March 8, 2013 21:37
ChildModelBindingPlugin
public class ChildModelBindingPlugin : IPlugin
{
public void Register(IAppHost appHost)
{
appHost.RequestFilters.Add(RequestFilter);
}
static void RequestFilter(IHttpRequest req, IHttpResponse res, object requestDto)
{
requestDto = Bind(requestDto, req.FormData);
@Sebmaster
Sebmaster / client.js
Last active December 16, 2015 15:39
Method to implement data-synchronization in angular.js via racer.js
var module = angular.module('racer.js', [], function ($provide) {
var setImmediate = window && window.setImmediate ? window.setImmediate : function (fn) {
setTimeout(fn, 0);
};
var racer = require('racer');
$provide.factory('racer', ['$http', '$q', '$rootScope', function ($http, $q, $rootScope) {
$http.get('/model').success(function (data) {
racer.init(data);
});
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active April 20, 2025 23:00
A badass list of frontend development resources I collected over time.
@azat-co
azat-co / express.js
Last active August 19, 2018 03:30
Tutorial: REST API with Node.js and MongoDB using Mongoskin and Express.js
var express = require('express')
, mongoskin = require('mongoskin')
var app = express()
app.use(express.bodyParser())
var db = mongoskin.db('localhost:27017/test', {safe:true});
app.param('collectionName', function(req, res, next, collectionName){
req.collection = db.collection(collectionName)
@enjalot
enjalot / hook.coffee
Last active December 20, 2015 05:58
derby server side hooks (to hold you over for now)
#make a hook
store.hook 'change', 'collection.*.foo', (docId, value, op, session, backend) ->
model = store.createModel()
#logic
#setup the hook method
store.hook = (method, pattern, fn) ->
store.shareClient.use 'after submit', (shareRequest, next) ->
{opData} = shareRequest