Skip to content

Instantly share code, notes, and snippets.

View capaj's full-sized avatar
🏠
Always working-be it from home or elsewhere

Jiri Spac capaj

🏠
Always working-be it from home or elsewhere
View GitHub Profile
@capaj
capaj / npmlog.txt
Created October 22, 2018 22:46
apollo-server-express error
0 info it worked if it ends with ok
1 verbose cli [ '/home/capaj/.nvm/versions/node/v8.11.4/bin/node',
1 verbose cli '/home/capaj/.nvm/versions/node/v8.11.4/bin/npm',
1 verbose cli 'link' ]
2 info using npm@6.4.1
3 info using node@v8.11.4
4 verbose linkPkg /home/capaj/git_projects/graphql-repos/apollo-server/packages/apollo-server-express
5 verbose link build target /home/capaj/.nvm/versions/node/v8.11.4/lib/node_modules/apollo-server-express
6 verbose npm-session 8c25d9a6a55659ed
7 silly install runPreinstallTopLevelLifecycles
@capaj
capaj / find-getters.js
Created January 4, 2018 17:44
find getters javascript
import traverse from 'traverse'
const findGetters = obj => {
const getters = []
traverse(obj).forEach(function (x) {
if (this.isRoot) {
return
}
const descriptor = Object.getOwnPropertyDescriptor(
this.parent.node,
@capaj
capaj / migrate-snap.js
Last active December 12, 2017 15:53
migrate a mysql db snapshot with node.js
const { shellSync } = require('execa')
const config = require('../../src/config/config')
const { password, username } = config.databases.sql
const dbName = 'my_db_name' // this DB will get migrated
const dumpFileName = 'my_db_dump.sql'
const shellSyncWithStdio = shCommand =>
shellSync(shCommand, { stdio: 'inherit' })
shellSyncWithStdio(
@capaj
capaj / install.sh
Last active September 1, 2018 10:19
installing pgloader on amazon linux
sudo yum -y install yum-utils rpmdevtools @development-tools sbcl sqlite-devel zlib-devel
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm
sudo yum install -y sbcl.x86_64
wget http://downloads.sourceforge.net/project/sbcl/sbcl/1.3.14/sbcl-1.3.14-source.tar.bz2
tar xfj sbcl-1.3.14-source.tar.bz2
cd sbcl-1.3.14
./make.sh
sudo sh install.sh
sbcl --version
@capaj
capaj / migration.js
Created October 8, 2017 12:48
iterate a column in all tables postgre
import db from './src/db'
const af = async () => {
const res = await db.raw(
`SELECT tablename FROM pg_tables WHERE schemaname='looop'`
)
console.log('res: ', res)
res.rows.forEach(async table => {
const { tablename } = table
@capaj
capaj / regexes.md
Created June 13, 2017 18:13
useful regexps when dealing with an old angular codebase

replace: angular.forEach\((\w*), with $1.forEach(

@capaj
capaj / keybase.md
Created February 4, 2017 19:09
keybase.md

Keybase proof

I hereby claim:

  • I am capaj on github.
  • I am capaj (https://keybase.io/capaj) on keybase.
  • I have a public key whose fingerprint is 104C DC80 705A 485E 520E A37B 8BBA 2432 8B3B 3031

To claim this, I am signing this object:

PS D:\git_projects\be\frontend-be.com> $env:TZ='UTC'
PS D:\git_projects\be\frontend-be.com> node
> new Date().toString()
'Wed Jan 11 2017 03:26:48 GMT+0100 (Central Europe Standard Time)'
@capaj
capaj / store.js
Created November 20, 2016 23:56
global-store
import {action, toJS} from 'mobx'
import storedObservable from './util/stored-observable'
const state = storedObservable('contact-list-state', {
contacts: [],
selectedId: null,
selectedType: null,
get selected () {
const propName = this.selectedType + 's'
const collection = this[propName]
@capaj
capaj / contact.js
Created November 20, 2016 23:42
contact class
class Contact {
@observable title;
@observable firstName;
@observable lastName;
@observable username;
@observable picture = {
thumbnail: null,
medium: null,
large: null,