Skip to content

Instantly share code, notes, and snippets.

View coldnew's full-sized avatar
💭
I may be slow to respond.

Yen-Chin,Lee coldnew

💭
I may be slow to respond.
View GitHub Profile
(ns racehub.om.facebook
(:require [cljs.core.async :as a]
[racehub.schema :as rs]
[schema.core :as s :include-macros true]))
;; ## Utilities
(defn prune
"Takes a mapping of keys -> new key names and a map and returns a
map with nils removed and keys swapped where they're present in the
@coldnew
coldnew / main.cpp
Last active January 5, 2016 10:09
Qt example for tarentella
#include <QApplication>
#include <QStringList>
#include <QListWidget>
#include <QRadioButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QListWidget *listWidget = new QListWidget();
@coldnew
coldnew / gist:33e230eca3ec70b24cbe
Created January 8, 2016 11:27 — forked from dmatveev/gist:2295597
GFileMonitor sample application. Watches the specified path, registers events and prints it on the screen.
#include <glib.h>
#include <gio/gio.h>
#include <string.h>
static GMainLoop *gMainLoop = NULL;
char *
decode (GFileMonitorEvent ev)
{
char *fmt = g_malloc0 (1024);
@coldnew
coldnew / Clojure_on_RaspberryPi_OSX.md
Created February 16, 2016 06:18 — forked from akiatoji/Clojure_on_RaspberryPi_OSX.md
Running Clojure on Raspberry Pi with OS X

Clojure on Raspberry Pi with OS X

"Clojure running on Raspberry Pi" sounded so cool that I just had to give it a try.

Install JDK

  • Download ARM JDK from Oracle and instlal on Raspberry Pi
  • Change visudo to contain the following
@coldnew
coldnew / git-extract-file.markdown
Created February 18, 2016 03:39 — forked from ssp/git-extract-file.markdown
Extract a single file from a git repository

How to extract a single file with its history from a git repository

These steps show two less common interactions with git to extract a single file which is inside a subfolder from a git repository. These steps essentially reduce the repository to just the desired files and should performed on a copy of the original repository (1.).

First the repository is reduced to just the subfolder containing the files in question using git filter-branch --subdirectory-filter (2.) which is a useful step by itself if just a subfolder needs to be extracted. This step moves the desired files to the top level of the repository.

Finally all remaining files are listed using git ls, the files to keep are removed from that using grep -v and the resulting list is passed to git rm which is invoked by git filter-branch --index-filter (3.). A bit convoluted but it does the trick.

1. copy the repository to extract the file from and go to the desired branch

@coldnew
coldnew / mountain.json
Created February 22, 2016 08:23 — forked from shaneriley/mountain.json
Render Tiled Scene in Canvas
{ "height":15,
"layers":[
{
"data":[79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 28, 60, 61, 62, 30, 95, 96, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 28, 76, 77, 78, 30, 79, 80, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 28, 76, 15, 78, 30, 95, 96, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 28, 76, 16, 78, 30, 79, 80, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 28, 76, 31, 78, 30, 95, 96, 95, 96, 79, 80, 95, 156, 157, 158, 95, 96, 79, 80, 95, 28, 76, 32, 78, 112, 13, 13, 79, 80, 95, 96, 79, 172, 173, 144, 158, 80, 95, 96, 79, 28, 76, 47, 48, 61, 61, 62, 95, 96, 79, 80, 156, 143, 138, 160, 190, 96, 12, 13, 13, 111, 76, 16, 15, 16, 31, 78, 13, 13, 14, 96, 172, 138, 173, 174, 79, 80, 44, 45, 45, 127, 92, 93, 93, 93, 93, 94, 109, 110, 30, 80, 188, 189, 189, 190, 95, 96, 79, 80, 95, 44, 45, 45, 45, 45, 45, 45, 141, 142, 30, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 45, 45, 46, 80, 95, 96, 79, 80, 95, 96, 79, 80, 95, 96, 79, 80,
@coldnew
coldnew / submodule-update-fix-snippet.yml
Created February 26, 2016 01:37 — forked from tbveralrud/submodule-update-fix-snippet.yml
(Temporary) Fix for submodule update error on CircleCI
# CircleCI failed to build a git submodule update step.
# Tracked it down to partially complete .git/modules existing in our source cache.
# This removes the .git/modules directory before the submodule update.
# The error:
# $ git submodule update --init
# git submodule update --init returned exit code 128
# fatal: Not a git repository: ../.git/modules/<project> Action failed: git submodule update --init
checkout:
@coldnew
coldnew / maptemplate.md
Created February 28, 2016 03:03 — forked from alandipert/maptemplate.md
ClojureScript macros: kinda, sorta, not really.

ClojureScript macros: kinda, sorta, not really.

ClojureScript does not have a standalone macro system. To write ClojureScript macros, one must write them in Clojure and then refer to them in ClojureScript code. This situation is workable, but at a minimum it forces one to keep ClojureScript code and the macros it invokes in separate files. I miss the locality of regular Clojure macros, so I wrote something called maptemplate that gives me back some of what I miss. The technique may be useful in other scenarios.

Problem

Suppose you're wrapping functionality in another namespace or package so that you can have your own namespace of identically named but otherwise decorated functions:

ClojureScript:

@coldnew
coldnew / README.md
Created March 11, 2016 02:07 — forked from boopathi/README.md
Creating a Swift-ReactNative project

Settings

  1. Create a project in XCode with the default settings
    • iOS > Application > Single View Application
    • Language: Swift
  2. Under project General settings, add ReactKit to Linked Framework and Libraries
    • + > Add Other... and choose /path/to/react-native/ReactKit/ReactKit.xcodeproj
  3. Now ReactKit would have been imported. Link it by choosing it from the list.
    • + > lib.ReactKit.a
  4. Under project Build Settings,