Skip to content

Instantly share code, notes, and snippets.

express (39)
jade (22)
q (21)
connect-redis (15)
ejs (15)
mongoose (13)
request (12)
redis (12)
restify (10)
@zladuric
zladuric / faves2.out
Created October 24, 2014 23:24
my faves output https://github.com/zeke/faves from my other machine (DO droplet)
express (41)
jade (34)
debug (23)
mkdirp (21)
optimist (16)
underscore (16)
mime (15)
async (15)
commander (14)
glob (13)
@zladuric
zladuric / endpoints_with_auth.md
Last active August 29, 2015 14:15
Test REST endpoints with auth
// Create something to test
db.test.insert({deep: {prop: 5}});
// Rename field
db.test.update({'deep.prop': {$exists: true}}, {$rename: {'deep.prop': 'deep.property'}}, {multi: true});
// Move to another object
// Note: leaves dangling `deep: {}`
db.test.update({'deep.property': {$exists: true}}, {$rename: {'deep.property': 'deeper.deep.property'}}, {multi: true});
// Demonstrating a point for: http://stackoverflow.com/questions/41814637/javascript-function-definition-explanation/41814751?noredirect=1#comment70848676_41814751
> [zlatko@zlatko-desktop ~]$ node
> function outer() {
... set();
... (function set() {})();
... }
undefined
> outer()
ReferenceError: set is not defined
at outer (repl:2:1)
import { Component, Injectable, Directive, Input, OnInit } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import {
async,
TestBed,
ComponentFixture
} from '@angular/core/testing';
import { SharedModule } from './shared/shared.module';
it('should upload a file', function() {
const request = require('request');
const headers = {
'Accept': '*/*',
'Origin': 'http://localhost:5555',
'x-amz-acl': 'public-read',
'Content-Type': 'video/quicktime',
};
const options = {
headers,
Animations with Angular
Typing this as a reminder on how to do certain animations with Angular4. Because I'll forget by next week.
Steps:
0. Prerequisits - BrowserAnimationsModule into the main app module
1. Define animations - `export const myAnimation = trigger(':nameOfAnimation', [ <list of transitions or states> ]);
2. Import `myAnimation` into the needed components
3. Bind as attributes, e.g. `[@myAnimation]="stateVariable"`
const request = require('request');
function callRemoteApi(url) {
return new Promise((resolve, reject) => {
console.log('Fetching', url);
request(url, (err, res) => {
if (err) {
return reject(err);
}
console.log('Got', url);
[{"ts":2.4710999999952037,"k":"T"},{"ts":2.6937999999936437,"k":"h"},{"ts":2.737599999993108,"k":"i"},{"ts":2.8377000000036787,"k":"s"},{"ts":2.9496999999973923,"k":" "},{"ts":3.104399999996531,"k":"i"},{"ts":3.189199999993434,"k":"s"},{"ts":3.284700000003795,"k":" "},{"ts":3.619200000001001,"k":"m"},{"ts":3.704700000002049,"k":"e"},{"ts":3.808900000003632,"k":"r"},{"ts":3.9293000000034226,"k":"e"},{"ts":4.0653999999922235,"k":"l"},{"ts":4.2013999999908265,"k":"y"},{"ts":4.423999999999069,"k":" "},{"ts":4.604299999991781,"k":"t"},{"ts":4.642200000002049,"k":"h"},{"ts":4.749199999991106,"k":"e"},{"ts":4.862599999993108,"k":" "},{"ts":5.052499999990687,"k":"b"},{"ts":5.161800000001676,"k":"e"},{"ts":5.389499999990221,"k":"g"},{"ts":5.455099999991944,"k":"i"},{"ts":5.531399999992573,"k":"n"},{"ts":5.809500000003027,"k":"n"},{"ts":6.178399999989779,"k":"i"},{"ts":6.241200000004028,"k":"n"},{"ts":6.375399999989895,"k":"g"},{"ts":6.563500000003842,"k":"."},{"ts":6.749400000000605,"k":" "},{"ts":7.933699999994133,"k