Skip to content

Instantly share code, notes, and snippets.

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]
(ns myApp.auth.google
"Google OAuth2 authentication using Friend auth framework."
(:require [compojure.core :refer :all]
[compojure.handler :as handler]
[compojure.route :as route]
[cheshire.core :as j]
[clj-http.client :as client]
[clojure.string :refer [split]]
[environ.core :refer [env]]
[taoensso.timbre :as timbre]
searchRepoLoop = ->
eventEmitter = require('events').EventEmitter
loop = ->
searchRepo()
.then ->
setTimeout(loop, 1000 * 60 * 60) # infinite loop with one hour delay
.catch (e) ->
eventEmitter.emit 'error', e
return eventEmitter
@realyze
realyze / test.js
Created May 11, 2015 08:46
Sequelize SERIALIZABLE isolation level error
var Sequelize = require('sequelize');
var Promise = require('bluebird');
var sequelize = new Sequelize('postgres://realyze@localhost:5432/trans-test');
var Transaction = sequelize.define('transaction', {
value: {
type: Sequelize.DECIMAL(10, 3),
field: 'value'
}
});

list

  • a
  • b

fooo

@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;