Skip to content

Instantly share code, notes, and snippets.

@jonvuri
jonvuri / .babelrc
Created August 20, 2016 19:11
Ava test
{
"presets": [
"es2015",
"react"
],
"plugins": [
["babel-root-slash-import", {
"rootPathSuffix": "src"
}]
]
C:\Users\...\AppData\Roaming\npm\node_modules\mocha\lib\utils.js:634
throw new Error("cannot resolve path (or pattern) '" + path + "'");
^
Error: cannot resolve path (or pattern) '"src/**/*.spec.js"'
at Object.lookupFiles (C:\Users\...\AppData\Roaming\npm\node_modules\mocha\lib\utils.js:634:15)
at C:\Users\...\AppData\Roaming\npm\node_modules\mocha\bin\_mocha:327:30
at Array.forEach (native)
at Object.<anonymous> (C:\Users\...\AppData\Roaming\npm\node_modules\mocha\bin\_mocha:326:6)
at Module._compile (module.js:541:32)
[ignore]
.*/node_modules/babel.*
.*/node_modules/fbjs/.*
.*/node_modules/config-chain/.*
.*/node_modules/npmconf/.*
[include]
node_modules/
[libs]
@jonvuri
jonvuri / sealed.js
Created June 6, 2016 14:40
Sealed object experiments with Flow
type Foo = {
prop: boolean,
prop2: boolean
};
type Bar = {
prop: boolean,
prop2: boolean,
[key: string]: void
}
@@ -3861,6 +3845,10 @@ Spasm.ShaderProgram.prototype.link = function() {
, c = this.fragmentShader;
b.attachShader(a, d.shader);
b.attachShader(a, c.shader);
+
+ // Force a_position (used in all shaders) to attribute 0 for performance
+ b.bindAttribLocation(a, 0, 'a_position')
+
b.linkProgram(a)
}
object Staticville {
// private def makeCitizen(country: Country): Citizen
private var citizen: Citizen = null
def getCitizen(implicit country: Country): Citizen = {
citizen = citizen match {
case null => {
class Generator {
// ...
}
object GeneratorUser {
def getGenerator(implicit seed: Int): Generator {
val gen = makeGenerator(seed)
gen.doSomethingElse() // Will error if called more than once, globally
gen
val managerOne: ManagerGetter[Manager[One]] = getManager(oneParam)
managerOne.get().write(one.key, one)
managerOne.flush()
@jonvuri
jonvuri / wrappedOrBareArm.scala
Last active March 9, 2016 15:37
How to complete?
/***
scalaVersion := "2.11.7"
libraryDependencies += "com.jsuereth" %% "scala-arm" % "1.4"
resolvers += "Akka Repository" at "http://repo.akka.io/releases/"
*/
import resource._
implicit def ftpResource = new Resource[FTPClient] {
override def close(client: FTPClient) = client.logout()
}