Skip to content

Instantly share code, notes, and snippets.

list

  • a
  • b

fooo

@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'
}
});
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
(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]
@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 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")))
### 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:
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) {
path = require 'path'
module.exports = (grunt) ->
grunt.initConfig
express:
options:
cmd: 'coffee'
delay: 50
dev:
@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