Skip to content

Instantly share code, notes, and snippets.

View FlatMapIO's full-sized avatar
😭
Focusing

dong.huo FlatMapIO

😭
Focusing
View GitHub Profile
@FlatMapIO
FlatMapIO / gaze.build.md
Last active August 29, 2015 14:14
gaze.build.log
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install', 'gaze', '-g' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink /usr/local/bin/node
5 silly cache add args [ 'gaze', null ]
6 verbose cache add spec gaze
7 silly cache add parsed spec { raw: 'gaze',
7 silly cache add   scope: null,
@FlatMapIO
FlatMapIO / gem-issue.sh
Created December 19, 2014 06:30
**MAC GEM ISSUE** It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby.
brew unlink libyaml
brew link libyaml
@FlatMapIO
FlatMapIO / osm2psql.sh
Created November 13, 2014 03:30
import osm to postgis
# prepare
psql -U postgres -d osm -f /path-to-psql/share/contrib/postgis-2.1/postgis.sql
psql -U postgres -d osm -f /path-to/osmosis/script/pgsnapshot_schema_0.6.sql
# import to pgsql
osmosis --read-pbf file=./xxx-latest.osm.pbf --wp host=localhost database=osm user=postgres
@FlatMapIO
FlatMapIO / ipable.clj
Created November 11, 2014 10:59
string extends ipable
(defprotocol IPify
(as-ip-array [this] "Take a string convert to InetAddress[]")
(as-ip [this] "Take a string convert to InetAddress[] only returh first item"))
(extend-type String
IPify
(as-ip-array [this]
(InetAddress/getAllByName this))
(as-ip [this]
(first (as-ip-array this))))
@FlatMapIO
FlatMapIO / mutable.clj
Created November 3, 2014 03:23
clojure mutable field type
(defprotocol IAttr
(-get [this])
(-set! [this v])
(deftype MutT [:volatile-mutable x]
IAttr
(-get [this] x)
(-set! [this v] (set! x v)))
(comment ; Fun with transducers, v2
;; Still haven't found a brief + approachable overview of Clojure 1.7's new
;; transducers in the particular way I would have preferred myself - so here goes:
;;;; Definitions
;; Looking at the `reduce` docstring, we can define a 'reducing-fn' as:
(fn reducing-fn ([]) ([accumulation next-input])) -> new-accumulation
;; (The `[]` arity is actually optional; it's only used when calling
;; `reduce` w/o an init-accumulator).
@FlatMapIO
FlatMapIO / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@FlatMapIO
FlatMapIO / 权限修正.md
Created August 30, 2014 10:18
权限修正

chmod -R a+rwx <file|dir> # a: all user