Skip to content

Instantly share code, notes, and snippets.

View bogdan's full-sized avatar

Bogdan Gusiev bogdan

View GitHub Profile
@jukkatupamaki
jukkatupamaki / 20190417131115_test-setup.ts
Last active June 21, 2023 07:03
How to use Knex.js in a TypeScript project
import { Knex } from 'knex'
export async function up(knex: Knex): Promise<any> {
await knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => {
table.integer('foobar');
});
}
export async function down(knex: Knex): Promise<any> {
await knex.schema.dropTable('test_setup');
vim ~/.ctags
--langdef=Solidity
--langmap=Solidity:.sol
--regex-Solidity=/^contract[ \t]+([a-zA-Z0-9_]+)/\1/c,contract/
--regex-Solidity=/[ \t]*function[ \t]+([a-zA-Z0-9_]+)/\1/f,function/
--regex-Solidity=/[ \t]*event[ \t]+([a-zA-Z0-9_]+)/\1/e,event/
--regex-Solidity=/[ \t]*(struct[ \t]+[a-zA-Z0-9_]+)([ \t]*\{)/\1/v,variable/
--regex-Solidity=/[ \t]*(enum[ \t]+[a-zA-Z0-9_]+)([ \t]*\{)/\1/v,variable/
--regex-Solidity=/[ \t]*mapping[ \t]+\(([a-zA-Z0-9_]+)[ \t]*=>[ \t]*([a-zA-Z0-9_]+)\)[ \t]+([a-zA-Z0-9_]+)/\3 (\1=>\2)/m,mapping/
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@AndrewRadev
AndrewRadev / mappings.vim
Created December 8, 2012 10:35
Star ("*") mapping that tries to be a bit smarter
" Using "g*" does two things differently from the normal "*":
"
" - Doesn't move the cursor, simply sets the match
" - When moving the cursor with "n" and "N", positions it where it was on the original word.
"
" Note: g* is ordinarily taken, see :help g*
"
nnoremap g* :call <SID>SmartStar()<cr>
function! s:SmartStar()
require "digest/md5"
require "resque-retry"
require "resque-loner"
#
# Statused Worker Example:
#
# class MyStatusedWorker < StatusedWorker
# def self.job_identity_arguments(user_id, credit_card_number, attributes = {})
# [user_id]