This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
name: "tw-stock", | |
author: { name: "Walter Chang", email: "[email protected]" }, | |
license: "Creative Commons 3.0 (by nc)", | |
description: "Quote a stock symbol from Taiwan Stock Exchange", | |
takes: {"stock symbol": noun_arb_text}, | |
preview: function(pblock, what) { | |
var msg = 'Gets stock quote for "${stockSymbol}"'; | |
var subs = { stockSymbol: what.text }; | |
pblock.innerHTML = CmdUtils.renderTemplate(msg, subs); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
name: "pronounce", | |
author: { name: "Walter Chang", email: "[email protected]" }, | |
license: "Creative Commons 3.0 (by nc)", | |
description: "Pronounce a selected or typed English word", | |
takes: {"word": noun_arb_text}, | |
preview: function(pblock, text) { | |
var msg = 'Pronounces "${word}"'; | |
var subs = { word: this._pickWord(text.text) }; | |
pblock.innerHTML = CmdUtils.renderTemplate(msg, subs); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Twitter Translate | |
// @namespace http://www.netgents.com/twitter-translate | |
// @description Translate tweets in a foreign language to English | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js | |
// @include http://twitter.com/* | |
// ==/UserScript== | |
$(document).ready(function() { | |
function addTranslate() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//harry huang [[email protected]] | |
// | |
//After reading the original post [http://jboner.github.com/2008/10/06/real-world-scala-dependency-injection-di.html, ] | |
//the original cake pattern seems quite verbose for me, and it is quite invasive, so I spent a bit time | |
//and come up with an improved version of cake pattern, which I call it a "Auto Cake DI". It is working | |
//well with any POST(plain old scala trait)/POSO(plain old scala object) which means that anything can be | |
//injected without modification or introducing new traits. | |
/*---------inject trait---------*/ | |
trait Inject[+T] { def inject: T } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package necsala.embedded | |
import scala.tools.nsc.interpreter.AbstractFileClassLoader | |
import scala.tools.nsc.{Global, Settings} | |
import scala.tools.nsc.util.BatchSourceFile | |
import scala.tools.nsc.io.{AbstractFile, VirtualDirectory} | |
import java.io.File | |
import java.util.jar.JarFile | |
import java.net.URLClassLoader |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../core-scaffold/core-scaffold.html"> | |
<link rel="import" href="../core-header-panel/core-header-panel.html"> | |
<link rel="import" href="../core-menu/core-menu.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../core-field/core-field.html"> | |
<link rel="import" href="../core-icon/core-icon.html"> | |
<link rel="import" href="../core-input/core-input.html"> | |
<link rel="import" href="../core-icons/core-icons.html"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// recursive function, "a" is the accumulator | |
int _reverse(int n, int a) { | |
if (n < 10) | |
return n + a; | |
else | |
return _reverse(n / 10, (a + (n % 10)) * 10); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package matryoshkasandbox | |
import matryoshka._ | |
import matryoshka.data._ | |
import matryoshka.implicits._ | |
import scalaz.Functor | |
object Exprs extends App { | |
sealed trait Expr[A] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package catssandbox | |
import aiyou._ | |
import aiyou.implicits._ | |
import cats._ | |
import cats.data._ | |
import org.atnos.eff._ | |
import org.atnos.eff.all._ | |
import org.atnos.eff.syntax.all._ | |
import IOEffect._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ngrams | |
import java.io.{ BufferedReader, FileReader } | |
import scala.collection.mutable | |
object NGrams2 extends App { | |
val start = System.currentTimeMillis | |
// download from https://github.com/codygman/faster-command-line-tools-with-haskell/raw/master/ngrams.tsv.tgz | |
val br = new BufferedReader(new FileReader("ngrams.tsv")) | |
val kvs = mutable.Map.empty[String, Int] |
OlderNewer