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 / 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,
/* global localStorage */
import {observable, autorunAsync} from 'mobx'
import _ from 'lodash'
function storedObservable (key, defaultValue, debounce) {
let fromStorage = localStorage.getItem(key)
const defaultClone = _.cloneDeep(defaultValue) // we don't want to modify the given object, because userscript might want to use the original object to reset the state back to default values some time later
if (fromStorage) {
_.merge(defaultClone, JSON.parse(fromStorage))
}
@capaj
capaj / serve.js
Last active August 29, 2021 14:14
socket.io acknowledge node.js sample
var io = require('socket.io')(8090);
io.on('connection', function (socket) {
console.log('connected')
socket.on('ferret', function (name, fn) {
console.log('ferret')
fn('woot');
});
});
failed with "unknown: Property body[0] of BlockStatement expected node to be of a type ["Statement"] but instead got "MemberExpression""