Skip to content

Instantly share code, notes, and snippets.

@realyze
realyze / watcher.coffee
Last active December 11, 2015 01:08
A script that mirrors changes made in your project to a local deployment in a Vagrant box.
# HOWTO
# =====
# 1. Share your project root directory with the Vagrant box. Let's say you
# call it `/home/vagrant/myapp`.
#
# 2. `vagrant shh into the Vagrant box and go to `/home/vagrant/myapp`.
#
# 3. Run
#
# sudo su - my_deploy_user -c 'coffee /home/vagrant/myapp/watcher.coffee'
var request = require('supertest'),
should = require('should'),
express = require('express');
var sessionStore = new express.session.MemoryStore();
var app = express()
var secret = 'aaaaaa'
var sessionID;
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:
qLine1 = promisifiedQueryDB('SQL HERE')
qLine1.then(function(line1) {
var promises = []
line1.lines.forEach(function(line2) {
promises.push(promisifiedQueryDB('SQL query for each line2 HERE'));
});
return Q.all(promises)
})
.then(function(arrayOfPromisesForLine2Results) {
### Keybase proof
I hereby claim:
* I am realyze on github.
* I am realyze (https://keybase.io/realyze) on keybase.
* I have a public key whose fingerprint is 88BF 63C1 2A3B 5CBB 3CE1 12C0 DA65 CD24 2F15 4250
To claim this, I am signing this object:
(ns slack-nag.core
(:require [clj-http.client :as client]
[hiccup.util]
[clojure.data.json :as json])
(:gen-class))
;; RB env vars
(def ^:private rb-url (delay (System/getenv "RB_URL")))
(def ^:private rb-user (delay (System/getenv "RB_USER")))
(def ^:private rb-password (delay (System/getenv "RB_PASSWORD")))
@realyze
realyze / timbre-core-typed.clj
Created November 21, 2014 05:42
Timbre and core.typed
(ns habanero.activity.jira
(:require [clj-xpath.core :as xpath :refer [$x $x:text, $x:text* $x:attrs*]]
[clj-time.format :as tf]
[clj-time.core :as tc]
[environ.core :refer [env]]
[clojure.string :refer [split]]
[trammel.core :refer [defconstrainedfn]]
[habanero.util]
[clojure.core.typed :as t]
[taoensso.timbre :as timbre]