Skip to content

Instantly share code, notes, and snippets.

View FlatMapIO's full-sized avatar
😭
Focusing

dong.huo FlatMapIO

😭
Focusing
View GitHub Profile
@rednaxelafx
rednaxelafx / DumpClassURL.java
Created December 7, 2011 09:48
Using the ProtectionDomain of an InstanceKlass to see where it was loaded from, with Attach API this time
import java.lang.instrument.Instrumentation;
import java.net.URL;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.Arrays;
import java.util.Comparator;
public class DumpClassURL {
public static void agentmain(String agentArgs, Instrumentation inst) {
Class<?>[] classes = inst.getAllLoadedClasses();
@spikebike
spikebike / client.go
Created March 29, 2012 01:13
TLS server and client
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@ckirkendall
ckirkendall / clojure-match.clj
Created June 15, 2012 02:26 — forked from bkyrlach/Expression.fs
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
@jamesmacaulay
jamesmacaulay / Clojure.sublime-settings
Last active January 18, 2021 19:01
Clojure stuff for Sublime Text 2. Files live in ~/Application Support/Sublime Text 2/Packages/User
// installed Clojure packages:
//
// * BracketHighlighter
// * lispindent
// * SublimeREPL
// * sublime-paredit
{
"word_separators": "/\\()\"',;!@$%^&|+=[]{}`~?",
"paredit_enabled": true,
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active June 4, 2024 04:16
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@staltz
staltz / introrx.md
Last active July 19, 2024 22:21
The introduction to Reactive Programming you've been missing
(require '[clojure.core.async :as a])
(def xform (comp (map inc)
(filter even?)
(dedupe)
(flatmap range)
(partition-all 3)
(partition-by #(< (apply + %) 7))
(flatmap flatten)
(random-sample 1.0)

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@norio-nomura
norio-nomura / build-package.sh
Created December 13, 2015 03:13
Script For Building OSX Installer Package of Swift-2.2-SNAPSHOT
#!/usr/bin/env bash
[ ! -x swift/utils/build-script ] && exit 1
SNAPSHOT_DATE=`date "+%Y-%m-%d"`
HASH_LLVM=`(cd llvm;git rev-parse --short HEAD)`
HASH_CLANG=`(cd clang;git rev-parse --short HEAD)`
HASH_SWIFT=`(cd swift;git rev-parse --short HEAD)`
HASH_INFO="LLVM ${HASH_LLVM}, Clang ${HASH_CLANG}, Swift ${HASH_SWIFT}"
BUNDLE_IDENTIFIER="io.nor.swift.${SNAPSHOT_DATE}" # "CFBundleIdentifier for xctoolchain info plist"