This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var test = require('tape'); | |
var calc = { | |
add: function(x,y){ | |
return x+y*2 | |
} | |
} | |
test('adding two numbers', function (t) { | |
var r = calc.add(2,2, 'this should add 2+2 & return 4') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// $paymentObject = '{ | |
// 'intent': "sale", | |
// "payer": { | |
// "payment_method": "credit_card", | |
// "funding_instruments": [{ | |
// "credit_card": { | |
// "number": "4032032647673208", | |
// "type": "visa", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const c = require('chalk') | |
const fetch = require('node-fetch') | |
const inspect = require('util').inspect | |
const l = str => console.log(inspect( str, { depth: 'Infinite', colors: true })) | |
/* | |
Client ID | |
AXVggvfsNB7SfW_gZNZ7TenVbkW5pylY9s9W3U6edvw5JTRK7TvazrFSUnFc4bzW4xUgihfZCaPHhctH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Backup comfy tables & static_contents table | |
pg_dump -Fc --clean --if-exists --no-owner -t 'comfy_*' -t static_contents omx_staging > comfy_backup_20180723.sql | |
# Well.. | |
dropdb omx_staging && createdb omx_staging | |
# Restore production data | |
pg_restore --no-owner -d omx_staging July232018-08_53_11.backup | |
# Restore comfy tables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create instance | |
docker run -d -p 5432:5432 --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword postgres | |
// enter instance | |
docker exec -it my-postgres bash | |
// ... create users, dbs, w/e ... | |
// Install psql on local machine | |
sudo apt-get install postgresql-client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def block_example(&block) | |
puts 'This goes before the execution' | |
yield | |
puts 'This goes after the execution' | |
end | |
block_example do | |
puts 'awesome ruby code goes here!' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" color column | |
set cc=100 | |
set nu rnu | |
" Indentation w/o hard tabs | |
set expandtab | |
set shiftwidth=2 | |
set softtabstop=2 | |
set tabstop=2 | |
set nowrap | |
set autoindent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\pset linestyle unicode | |
\pset border 2 | |
\pset null '⌁' | |
\pset format wrapped | |
\timing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set bytea_output to 'escape'; | |
-- delete | |
select session_id, decode(data, 'base64')::text | |
from sessions | |
where decode(data, 'base64')::text ilike '%return_to%' | |
and decode(data, 'base64')::text ilike '%password%new%'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
opportunities.id "opp_id", | |
title, | |
expiry_date, | |
ROW_NUMBER() OVER dupes, | |
FIRST_VALUE(opportunities.id) OVER dupes "parent" | |
FROM opportunities | |
WINDOW dupes AS (PARTITION BY opportunities.title, opportunities.expiry_date ORDER BY opportunities.created_at) |
OlderNewer