Skip to content

Instantly share code, notes, and snippets.

@qcom
qcom / error.out
Created September 10, 2015 20:02
{ [Error: read ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }
Error: read ECONNRESET
at exports._errnoException (util.js:746:11)
at TCP.onread (net.js:559:26)
>>>> In-memory PM2 is out-of-date, do:
>>>> $ pm2 updatePM2
In memory PM2 version: 0.14.0
Local PM2 version: 0.12.16
[PM2] Process app.js launched
@qcom
qcom / package.json
Created May 19, 2015 08:32
admire my tests ;)
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build-css": "cat public/css/global.css public/css/newLayout/*.css > public/css/style.css",
"build-js": "browserify public/js/newLayout/main.js > public/js/newLayout/bundle.js",
"build": "npm run build-css & npm run build-js",
"start": "npm run build && NODE_ENV=production pm2 start app.js",
"watch-css": "catw public/css/global.css public/css/newLayout/*.css -o public/css/style.css",
"watch-js": "watchify public/js/newLayout/main.js -o public/js/newLayout/bundle.js",
"watch": "npm run watch-css & npm run watch-js",
"start-dev": "npm run watch & nodemon app.js"
@qcom
qcom / .bashrc
Created May 14, 2015 21:18
bashrc
export PS1="\u:\W –> "
export GITAWAREPROMPT=~/.bash/git-aware-prompt
source $GITAWAREPROMPT/main.sh
export PS1="\[$txtpur\][\!] \[$txtgrn\](\u) \[$bldred\]\w \[$bldpur\]\$\[$txtrst\]\[$txtrst\]\[$bldblu\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]"
export EDITOR='vim'
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
PATH=$PATH:$HOME/bin
@qcom
qcom / clean.sql
Created March 16, 2015 23:00
why
select * from (
select C3.ObjectId, C3.CategoryId, C3.CategorizationId, TheCount,
ROW_NUMBER() OVER (ORDER BY C3.ObjectId, C3.CategoryId, C3.Categorizationid desc) as RowNumber
from Categorization as C3 right outer join (
select (select Code from Product where ProductId = ObjectId) as Code, C1.ObjectId, C1.CategoryId, (
select count(*) from Categorization as C2 where C2.ObjectId = C1.ObjectId and C2.CategoryId = C1.CategoryId
) as TheCount
from Categorization as C1
where (select count(*) from Categorization as C2 where C2.ObjectId = C1.ObjectId and C2.CategoryId = C1.CategoryId) > 1
group by C1.CategoryId, C1.ObjectId
@qcom
qcom / flow.js
Last active August 29, 2015 14:07
async.waterfall([
soap.createClient.bind(null, process.cwd() + '/util/usaepay.wsdl'),
function(client, cb) {
client.runSale(args, cb);
},
function(result, body, cb) {
if (result.runSaleReturn.ResultCode.$value === 'E') {
return new Error('failed to process');
} else if (result.runSaleReturn.ResultCode.$value === 'A') {
return cb(null, result);
@qcom
qcom / OrderedVector.java
Created September 24, 2014 01:16
ordered vector implementation
package data_structures;
import java.util.Iterator;
import java.util.NoSuchElementException;
import data_structures.*;
public class OrderedVector<E> implements Iterable<E> {
private E[] arr;
private int size;
@qcom
qcom / OrderedVector.java
Last active August 29, 2015 14:06
vector implementation
package data_structures;
import java.util.Iterator;
import java.util.Arrays;
import java.lang.*;
public class OrderedVector<E> implements Iterable<E> {
private E[] arr;
private int size;
private static final int DEFAULT_MAX_CAPACITY = 2;
CREATE TYPE feedback_type AS ENUM('rolloffs', 'waste', 'hauling', 'commerical', 'residential');
CREATE TABLE IF NOT EXISTS company_feedback (
id serial PRIMARY KEY,
company integer REFERENCES companies(id) NOT NULL,
ip text NOT NULL,
"type" feedback_type NOT NULL,
affirmative boolean NOT NULL
);
CREATE TABLE IF NOT EXISTS items_industries (
item integer REFERENCES items(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
industry integer REFERENCES industries(id) ON DELETE CASCADE
);