Skip to content

Instantly share code, notes, and snippets.

View davidlee's full-sized avatar

David Lee davidlee

View GitHub Profile
@alexy4744
alexy4744 / closure-table.repository.ts
Last active February 27, 2024 08:19
MikroORM Closure Table Repository
import { Constructor } from "@mikro-orm/core";
import { EntityRepository, Knex } from "@mikro-orm/postgresql";
type Node = string;
export interface ClosureTableRepository<Entity> extends EntityRepository<Entity> {
containsDescendant(parent: Node, descendant: Node): Promise<boolean>;
findDescendants(parent: Node): Knex.QueryBuilder;
insertLeafNode(leaf: Node, parent: Node): Promise<void>;
insertRootNode(root: Node): Promise<void>;

Docker on Mac OS X

These are my notes based on my experience with using Docker on Mac OS X.

Assumptions

If these assumptions are not true for you, then this document may not be for you.

I assume you have these installed:

  • recent-ish Mac OS X
@latentflip
latentflip / Rakefile
Created January 9, 2012 17:44
A better Rakefile for rails?
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
#Load all the tasks in lib/tasks
Dir[File.expand_path('../lib/tasks/', __FILE__) + '/*.rake'].each do |file|
load file
end
#The original rails rakefile loading
@jbulow
jbulow / getemacs.sh
Created November 24, 2011 20:35
full screen emacs 24 on osx snow leopard/lion
# Git Emacs 24 from the main Savannah (savannah.gnu.org) repository and apply typester's fullscreen patch
rm -fr emacs
git clone git://git.savannah.gnu.org/emacs.git
cd emacs
wget http://cloud.github.com/downloads/typester/emacs/feature-fullscreen.patch
patch -p1 -i feature-fullscreen.patch
cd ..
curl -O http://ftp.gnu.org/gnu/m4/m4-1.4.13.tar.gz
tar -xzvf m4-1.4.13.tar.gz
cd m4-1.4.13
@davidlee
davidlee / MNEM spec
Created June 17, 2011 10:05
MNEM - the object database I'd quite like
;; This buffer is for notes you don't want to save, and for Lisp
;; evaluation. If you want to create a file, visit that file with C-x
;; C-f, then enter the text in that file's own buffer.
MNEM
An object database which stores and manipulates simple structures of
data (hashes, arrays, strings, and numbers), knows how to talk JSON,
keeps a copy of everything that has ever been entered, and implements
updates as pull requests.
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
anonymous
anonymous / gist:858586
Created March 7, 2011 14:51
game.components.core
(ns game.components.core
(:use
[clojure.contrib.def :only (defvar-)]
(game.utils [core :only (safe-merge
keywords-to-hash-map
get-unique-number
runmap
if-do
distinct-seq?)])))
@nkpart
nkpart / article.md
Created September 16, 2010 10:32
Kit - package manager for Objective-C

Packages. Boy, I just don't know.

I'd like to introduce a tool I've written, that I hope will make it easier to share objective-C code across iPhone projects.

The tool is Kit. To install it, you'll need the latest haskell platform release for OS X. Kit installs through haskell's package manager:

$ brew install haskell-platform # If you've got brew, otherwise: http://hackage.haskell.org/platform/mac.html
$ cabal update

$ cabal install kit

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')