Skip to content

Instantly share code, notes, and snippets.

var qProjects = $http.get('db/view/projects/all')
.then(function(res){
if ( ! res.data) {
$q.reject(new Error('No project data received.'));
}
return data;
});
var qClients = $http.get('db/view/clients/map')
.then(function(res) {
# coffeelint: disable=max_line_length
describe 'auth', () ->
authService = null
$cookieStore = null
angular.module('cookieStoreMock', [])
.factory '$cookieStore', -> {get: -> 'name'}
beforeEach ->
@realyze
realyze / server.coffee
Last active December 19, 2015 22:29
Adding cookie to allow client authentication.
express = require 'express'
config = require 'config'
app = express()
app.configure ->
app.use '/static/', express.static config.static_root path.join __dirname, '/../client/build'
app.use '/static/', (req, res, next) ->
# We're requesting a non-existent static resource.
res.send 404
path = require 'path'
module.exports = (grunt) ->
grunt.initConfig
express:
options:
cmd: 'coffee'
delay: 50
dev:
@realyze
realyze / slow_query.js
Last active January 16, 2016 10:58
Slow meteor query
if (Meteor.isClient) {
Meteor.startup(function () {
var messageThreads = new Mongo.Collection(null);
for (var i = 0; i < 1500; ++i) {
messageThreads.insert({
_id: new Mongo.ObjectID().toHexString(),
"posts": [
@realyze
realyze / meteor_slow
Created January 16, 2016 11:12
slow meteor query
if (Meteor.isClient) {
Meteor.startup(function () {
var collection = new Mongo.Collection(null);
for (var i = 0; i < 1000; ++i) {
collection.insert({
_id: new Mongo.ObjectID().toHexString(),
"kind": "t3",
@realyze
realyze / packages
Last active April 5, 2017 07:16
accounts-google@1.1.1 error
meteor-base # Packages every Meteor app needs to have
mobile-experience # Packages for a great mobile UX
mongo # The database Meteor supports right now
blaze-html-templates # Compile .html files into Meteor Blaze views
reactive-var # Reactive variable for tracker
jquery # Helpful client-side library
tracker # Meteor's client-side reactive programming library
standard-minifier-css # CSS minifier run for production mode
standard-minifier-js # JS minifier run for production mode
@realyze
realyze / pizza.js
Last active February 14, 2018 19:40
Pizza challenge
const defer = (res, ms) => new Promise(resolve => setTimeout(() => resolve(res), ms));
const makeDough = () => defer({add: () => {}}, 500);
const makeSauce = () => defer({determineCheese: () => 'cheddar'}, 250);
const grateCheese = () => defer({type: 'cheddar'}, 150);
async function makePizza(sauceType = 'red') {
const pDough = makeDough();
FILES=$(git diff --name-only `git merge-base HEAD green`)
FORMAT_BIN=${HOME}/.ideaformatter/Contents/bin/format.sh
if [[ ! -f ${FORMAT_BIN} ]]; then
echo 'Please symlink idea into $HOME/.ideaformatter';
exit 1;
fi
FILES_ARR=($FILES)
ABS_FILES=( "${FILES_ARR[@]/#/`cd .. && pwd`/}" )
it('renders results', () => {
const { configuration } = install();
const Results = configuration.Results!;
expect(toJson(shallow(<Results />), {
noKey: false,
map: (val) => {
// Filter out noisy rxjs subscription from the snapshot.
if (val.type === 'ResultsListScrollContainer') {
val.props.resultState.subscription = {};
}