Skip to content

Instantly share code, notes, and snippets.

View lamogura's full-sized avatar

Justin Kovalchuk lamogura

  • TeamSofa
  • Tokyo, Japan
View GitHub Profile
@lamogura
lamogura / dev_server.js
Created January 10, 2017 06:58
brunch proxied dev server
// 1. npm i -D express http-proxy
// 2. add to config: "server: { path: 'dev_server' }"
const express = require('express')
const sysPath = require('path')
const http = require('http')
const httpProxy = require('http-proxy')
const apiProxy = httpProxy.createServer({
target: 'http://localhost:3000'
})
@lamogura
lamogura / conftest.py
Created December 13, 2016 00:22
pytest flask sqlalchemy setup that should work when model schemas are compatible with sqlite
# import pytest
# from server.api import create_app
# @pytest.fixture
# def client():
# return create_app().test_client()
# import os
import pytest
import json
@lamogura
lamogura / secret_dokku_command.sh
Created December 5, 2016 02:52
secret thing dokku doesnt tell you is needed to actually work
cat /path/to/public_key | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku [description]"
@lamogura
lamogura / .babelrc
Created September 27, 2016 07:37
.babelrc for react project
{
"install-then-remove": "npm i -D babel-plugin-transform-class-properties babel-preset-es2015 babel-preset-react babel-preset-stage-2 babel-plugin-lodash",
"presets": [
"react",
"es2015",
"stage-2"
],
"plugins": [
"transform-class-properties",
"lodash"
@lamogura
lamogura / .babelrc
Created September 27, 2016 07:36
.babelrc for JS projrect
{
"install-then-remove": "npm i -D babel-plugin-transform-class-properties babel-preset-es2015 babel-preset-stage-2",
"presets": [
"es2015",
"stage-2"
],
"plugins": [
"transform-class-properties"
]
}
@lamogura
lamogura / .eslint
Created September 27, 2016 07:35
eslint for JS project
{
"install-then-remove": "npm i -D eslint eslint-config-standard eslint-plugin-babel eslint-plugin-promise eslint-plugin-standard babel-eslint",
"extends": ["standard"],
"ecmaFeatures": {
"modules": true
},
"env": {
"browser": true,
"es6": true,
"node": true
@lamogura
lamogura / .eslint
Created September 27, 2016 07:34
eslint rules for react project
{
"install-then-remove": "npm i -D eslint eslint-config-standard eslint-config-standard-jsx eslint-config-standard-react eslint-plugin-babel eslint-plugin-promise eslint-plugin-react eslint-plugin-standard",
"extends": ["standard", "standard-react", "plugin:react/recommended"],
"env": {
"browser": true,
"es6": true
},
"parser": "babel-eslint",
"plugins": [
"react"
@lamogura
lamogura / gist:2e0553e453602a4daca31d4e971cd7b6
Created September 13, 2016 02:13
drop all tables in postgres db
psql -h <pg_host> -p <pg_port> -U <pg_user> <pg_db> -t -c "select 'drop table \"' || tablename || '\" cascade;' from pg_tables where schemaname='public'" | psql -h <pg_host> -p <pg_port> -U <pg_user> <pg_db>
// remember to have the password set in .pgpass file, host:port:db:user:pass
@lamogura
lamogura / APNStoPEM
Created December 9, 2012 11:07
Convert ApplePushNotificationService Certy&KEY to PEM file
1) Convert to PEM format
These files now need to be converted to the PEM format by executing these 2 commands from the terminal:
openssl pkcs12 -clcerts -nokeys -out apns-prod-cert.pem -in apns-prod-cert.p12
openssl pkcs12 -nocerts -out apns-prod-key.pem -in apns-prod-key.p12
You will be forced to set a PEM passphrase on the second command, so execute the following command to remove it:
openssl rsa -in apns-prod-key.pem -out apns-prod-key-noenc.pem
@lamogura
lamogura / nslog_macros.h
Created December 8, 2012 16:36
NSLog() Macros for iOS Development
// ***note*** this is ARC enabled code
// DLog will output like NSLog only when the DEBUG variable is set
// ALog will always output like NSLog
// ULog will show the UIAlertView only when the DEBUG variable is set
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);