Skip to content

Instantly share code, notes, and snippets.

destroy: function(req, res) {
var id = req.param('id');
MyModel.findOne(id)
.exec(function foundRecord (err, record) {
if (err) return res.serverError(err);
if(!record) return res.notFound('No record found with the specified `id`.');
MyModel.destroy(id)
.exec(function(err) {
if (err) return res.negotiate(err);
var axon = require('axon');
var sock = axon.socket('pub');
sock.bind(3000);
console.log('pub server started');
setInterval(function(){
sock.send('hello');
}, 500);
function which {
Param ([String]$Name)
(Get-Command $Name).Definition
}
@adicirstei
adicirstei / data.json
Last active September 11, 2015 07:27
homework d3 vis
[
{"year": "1990",
"party": "Republicans",
"spending": 299
},
{"year": "1990",
"party": "Democrats",
"spending": 376
},
{"year": "2006",
@adicirstei
adicirstei / bad.elm
Created January 8, 2016 09:34
minimal Elm
main = 42
@adicirstei
adicirstei / WinForm.fsx
Last active April 4, 2022 17:17
Fully reactive UI in F# with observables
open System
open System.Windows.Forms
open System.Drawing
type Action =
| Increment
| Decrement
let form = new Form(Width= 400, Height = 300, Visible = true, Text = "Hello World")
@adicirstei
adicirstei / Rx-WinForm.fsx
Created February 29, 2016 14:46
Rx-flavor reactive WinForm
#I "packages/Rx-Linq/lib/net45"
#I "packages/Rx-Interfaces/lib/net45"
#I "packages/Rx-Core/lib/net45"
#I "packages/FSharp.Control.Reactive/lib/net40"
#r "FSharp.Control.Reactive.dll"
#r "System.Reactive.Core.dll"
#r "System.Reactive.Interfaces.dll"
#r "System.Reactive.Linq.dll"
@adicirstei
adicirstei / BTrees.elm
Last active July 20, 2016 12:12
Ninety-nine Elm Problems
type Tree a =
Empty
| Node a (Tree a) (Tree a)
mirror : Tree a -> Tree a
mirror t =
case t of
Empty -> Empty
Node v l r -> Node v (mirror r) (mirror l)
@adicirstei
adicirstei / design.fsx
Created October 13, 2016 09:36
How do I design this?
/// My function types
type Backward<'Core> = 'Core -> 'Core
type InputCore = {
backward : Backward<InputCore>
x : float
}
type TanhCore = {
backward : Backward<TanhCore>
@adicirstei
adicirstei / Exception.elm
Created November 29, 2016 15:32
Elm run-time exceptions
import Html exposing (beginnerProgram, div, span, button, text)
import Html.Events exposing (onClick)
type Msg
= Increment Int
| Decrement Int
type alias Model =
{ action : Int -> Msg