Skip to content

Instantly share code, notes, and snippets.

@mizchi
mizchi / hello.rs
Created November 26, 2017 17:08 — forked from anonymous/hello.rs
fn main() {}
#[no_mangle]
pub fn add_one(x: i32) -> i32 {
x + 1
}
@mizchi
mizchi / hello.rs
Created November 26, 2017 17:08 — forked from anonymous/hello.rs
fn main() {}
#[no_mangle]
pub fn add_one(x: i32) -> i32 {
x + 1
}
declare module Foo {
export class Hoge {
f(str:string, n: number, obj: Object): number;
s: string;
//f(name:string): number;
}
}
@mizchi
mizchi / dummy.d.ts
Last active August 29, 2015 14:01 — forked from anonymous/main.coffee
declare module Foo {
export class Hoge {
name:string;
message:string;
constructor();
f(str:string):string;
}
}
@mizchi
mizchi / javascript_resources.md
Created March 20, 2014 05:03 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@mizchi
mizchi / 0_reuse_code.js
Created March 20, 2014 05:02
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
@mizchi
mizchi / injector.scala
Last active August 29, 2015 13:56 — forked from anonymous/injector.scala
simple inejctor
import scala.reflect.{classTag, ClassTag}
object Injector {
private val rootInjector = new Injector(None)
def createInjector = rootInjector.createChild(rootInjector)
def mapValue[T:ClassTag](instance:T): Unit =
rootInjector.mapValue[T](instance)
}
class Injector(val parent:Option[Injector]) {
# in gruntfile.coffee
{exec} = require('child_process')
runCommand = (exp, done) ->
exec exp, (error, stdout, stderr) ->
return done(true) if error or stderr
done(false,stdout)
grunt.registerMultiTask 'test', 'test command', ->
conf = @
@mizchi
mizchi / sinon_test_pattern.coffee
Created August 7, 2012 07:22 — forked from anonymous/test.coffee
sinonの練習
sinon = require 'sinon'
# class stubbing
class MockClass
method: ->
method2: ->
sinon.stub(MockClass.prototype, 'method').withArgs(1).returns 42
obj = new MockClass
console.log obj.method(1) #=> 42