Skip to content

Instantly share code, notes, and snippets.

@jkyamog
jkyamog / gist:5687702
Last active December 17, 2015 23:09
reactive mongo that can be used with angular resources. make sure to perform validation before inserts and updates. there are 2 json readers, this is used to transform mongo object to and from the front end (FE). Then 2 sample api calls to use them, there is an assumption that id or _id will always be there, otherwise its a runtime exception.
val mongoToFE =
__.json.update((__ \ 'id).json.copyFrom( (__ \ '_id \ '$oid).json.pick )) andThen
(__ \ '_id).json.prune
val FEtoMongo =
__.json.update((__ \ '_id \ '$oid).json.copyFrom( (__ \ 'id).json.pick )) andThen
(__ \ 'id).json.prune
Async {
val items = collection.find(BSONDocument("_id" -> objectId)).cursor[JsObject]
@balupton
balupton / README.md
Last active June 7, 2021 16:00
Node.js Best Practice Exception Handling
anonymous
anonymous / Gruntfile.js
Created January 5, 2013 14:28
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta:{
banner:'/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
@mslinn
mslinn / PaypalController.scala
Last active June 9, 2017 22:22 — forked from alpeb/Paypal.scala
Paypal IPN script for Play 2.1
package controllers
import play.api._
import libs.ws.WS
import play.api.mvc._
import com.micronautics.paypal.{TransactionProcessor, PaypalTransactions}
import java.net.URLEncoder
import concurrent.{Await, ExecutionContext}
import concurrent.duration.Duration
import java.util.concurrent.TimeUnit
@addyosmani
addyosmani / cranium.js
Last active February 7, 2019 15:02
Cranium
/* Cranium MVC
* A minimalist MVC implementation written for
* demonstration purposes at my workshops
* http://addyosmani.com
* Copyright (c) 2012 Addy Osmani; Licensed MIT */
var Cranium = Cranium || {};
// Set DOM selection utility
@danro
danro / Custom.css
Created September 16, 2012 17:32
Improved webkit inspector toolbar
#-webkit-web-inspector #toolbar {
background: #cdcdcd !important;
height: 36px !important;
}
#-webkit-web-inspector #main {
top: 36px !important;
}
#-webkit-web-inspector .toolbar-item.elements:hover:after {
content: "elements";
z-index: 9999;
@loicdescotte
loicdescotte / iteratees_humains.md
Last active October 10, 2015 17:47
Play2 : Les Iteratees expliqués aux humains... francophones!

#Play2 : Les Iteratees expliqués aux humains... francophones!

Disclaimer : Ce qui suit est la traduction d'un article anglophone paru sur le blog mandubian.com

Vous pouvez retrouver l'article original ici

Vous avez probablement remarqué une nouvelle fonctionnalité intrigante de Play2 nommée Iteratee (ainsi que ses compagnons Enumerators et Enumeratee). Le but de cet article est d'essayer de rendre le concept d'Iteratee compréhensible pour le plus grand nombre avec des arguments simples, en évitant l'approche mathématique / fonctionnelle.

Cet article ne prétend pas tout expliquer à propos des Iteratee / Enumerator / Enumeratee mais traite plutôt les idées qui se cachent derrière.

@feliperazeek
feliperazeek / gist:3537872
Created August 30, 2012 19:07 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

CTags

Ctrl-t Ctrl-r rebuild tags
Ctrl-t Ctrl-y search for definitions

General

⌘T go to file
@addyosmani
addyosmani / notes.md
Created August 29, 2012 17:44
Better Model Property Validation On Set/Save

(rough-cut for Backbone Fundamentals)

Better Model Property Validation On Set/Save

As we learned earlier in the book, the validate method on a Model is called before set and save, and is passed the model attributes updated with the values from these methods.

By default, where we define a custom validate method, Backbone passes all of a Model's attributes through this validation each time, regardless of which model attributes are being set.

This means that it can be a challenge to determine which specific fields are being set or validated without being concerned about the others that aren't being set at the same time.

@k33g
k33g / RaspBerry_Pi.md
Created August 17, 2012 12:01
RaspBerry Pi