Skip to content

Instantly share code, notes, and snippets.

View also's full-sized avatar

Ryan Berdeen also

View GitHub Profile
(def ^:dynamic *dynamic*)
(push-repl-bindings {(var *dynamic*) 1}) ; push-repl-bindings isn't a function
*dynamic*
; => 1
Hello = ->
render: ->
{type: 'div', props: {children: "Hello, #{@props.name}!"}, _isReactElement: true}
React.render {type: Hello, props: {name: 'World'}, _isReactElement: true}, document.body
@also
also / a.cljs
Last active April 26, 2024 20:25
require-macros and syntax quoting
(ns a
(:require-macros [clojure.string :as alias]))
; this is fine
`xxx/name
; this throws clojure.lang.Symbol cannot be cast to clojure.lang.Namespace
`alias/name
var eslint = require('eslint');
var CLIEngine = eslint.CLIEngine;
var linter = eslint.linter;
var baseConfig = {format: 'stylish'};
console.log(baseConfig.format);
new CLIEngine({baseConfig: baseConfig}).getConfigForFile('.');
console.log(baseConfig.format);
Proceed onto Highland Avenue 5.1
Right onto Cherry Street 5.2
Proceed onto Cherry Street 5.2
Left onto Hall Street 5.3
Proceed onto Hall Street 5.3
Right onto Cedar Street 5.4
Left onto Summer Street 5.4
Proceed onto Summer Street 5.4
Left onto Porter Street 5.5
Right onto Crown Street 5.6
/* @flow */
type T1 = {x : number};
type T2 = {y : number};
type T3 = T1 & T2;
function mergeAndDoStuff(t1 : T1, t2 : T2) : T3 {
const result = Object.assign({}, t1, t2);
console.log(result.info.toString()); // at one time, T1 contained info, but it was removed
return result;
}
@also
also / pbpaste-html.js
Created March 17, 2016 05:45
Get HTML from OS X RTF clipboard
var $ = require('nodobjc');
$.framework('AppKit');
function getNSData(data) {
var byteBuffer = new Buffer(data('length'));
data('getBytes', byteBuffer, 'length', byteBuffer.length);
return byteBuffer;
}
var toHtmlOpts = $.NSDictionary(
@also
also / README.md
Last active September 30, 2016 18:04
webpack context resolver bug

webpack/webpack#3082

$ npm test

> @ test /Users/rberdeen/work/scratch/webpack-require-context
> webpack test.js out.js

Hash: 6fdd8fd64209c6bbad29
Version: webpack 2.1.0-beta.25
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
acorn-globals@^1.0.3:
version "1.0.9"
resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-1.0.9.tgz#55bb5e98691507b74579d0513413217c380c54cf"
dependencies:
acorn "^2.1.0"