Skip to content

Instantly share code, notes, and snippets.

View bulkan's full-sized avatar
🇯🇵

Savun Bulkan Evcimen bulkan

🇯🇵
View GitHub Profile
<!--
To run;
python -m SimpleHTTPServer
http://locahost:8000
-->
<html>
<body>
@bulkan
bulkan / user.js
Created January 7, 2015 22:39
Mocking Sequelize model function
var Promise = require('bluebird');
var sinon = require('sinon');
var User = require('./db/models').User;
describe('User model', function(){
var userFindStub;
var sandbox;
before(function(){
sandbox = sinon.sandbox.create();
1) [POSTGRES Specific] DAO should be able update a field with type ARRAY(JSON):
SequelizeDatabaseError: invalid input syntax for type json
at module.exports.Query.formatError (/Users/bulkan/src/javascript/sequelize/lib/dialects/postgres/query.js:283:16)
at null.<anonymous> (/Users/bulkan/src/javascript/sequelize/lib/dialects/postgres/query.js:64:21)
at emit (events.js:95:17)
at NativeQuery.handleError (/Users/bulkan/src/javascript/sequelize/node_modules/pg/lib/native/query.js:69:10)
at Connection.<anonymous> (/Users/bulkan/src/javascript/sequelize/node_modules/pg/lib/native/index.js:182:31)
at Connection.emit (events.js:95:17)
From previous event:
@bulkan
bulkan / main.go
Last active August 29, 2015 14:05
package main
import (
"fmt"
"net/http"
//"encoding/json"
"os"
"github.com/bitly/go-simplejson"
)
package main
import (
"os"
"os/exec"
"bytes"
"log"
"fmt"
)
[~]: brew outdated
Error: undefined method `new' for Zlib:Module
Please report this bug:
https://github.com/Homebrew/homebrew/wiki/troubleshooting
/usr/local/Library/Homebrew/formulary.rb:50:in `get_formula'
/usr/local/Library/Homebrew/formulary.rb:194:in `factory'
/usr/local/Library/Homebrew/formula.rb:377:in `block in installed'
/usr/local/Library/Homebrew/formula.rb:375:in `map'
/usr/local/Library/Homebrew/formula.rb:375:in `installed'
/usr/local/Library/Homebrew/cmd/outdated.rb:16:in `outdated_brews'
/* To terminate connections of current users */
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET-db'
AND pid <> pg_backend_pid();
/* update a timestamp field setting it 1 hour in the past from now */
@bulkan
bulkan / gh.js
Last active August 29, 2015 14:00
var request = require('request')
, Promise = require('bluebird')
, getAsync = Promise.promisify(request.get);
module.exports.getProfile = function getProfile(username) {
return getAsync('https://api.github.com/users/' + username);
}
@bulkan
bulkan / 0_reuse_code.js
Created April 15, 2014 05:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console