Skip to content

Instantly share code, notes, and snippets.

View tikurahul's full-sized avatar
:shipit:
Tinkering

Rahul Ravikumar tikurahul

:shipit:
Tinkering
View GitHub Profile
@eamelink
eamelink / iteratees-by-example.scala
Created May 23, 2013 21:40
Scala-IDE worksheet with some examples of iteratees, enumerators and enumeratees and how to use and compose them. Originated from a presentation at Dutch Scala Enthusiasts.
import play.api.libs.iteratee._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent._
import scala.concurrent.duration._
import play.api.libs.concurrent.Promise
object iteratees {
// Implicit conversion to add 'await' to a Future
implicit class WFuture[A](val inner: Future[A]) extends AnyVal {
fractalModule =function(stdlib){
"use asm";
var pow = stdlib.Math.pow;
var abs = stdlib.Math.abs;
var atan2 = stdlib.Math.atan2;
var cos = stdlib.Math.cos;
var sin = stdlib.Math.sin;
function mandlebrot(cx, cy, maxIter) {
cx = +cx;
cy = +cy;
@swankjesse
swankjesse / Rip.java
Created February 8, 2013 23:27
Stream editor for Java nerds. Use Java regular expressions to break up lines, and Java format strings to put them back together again.
/*bin/mkdir /tmp/rip 2> /dev/null
javac -d /tmp/rip $0
java -cp /tmp/rip Rip "$@"
exit
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.regex.Matcher;

Snow in canvas land

Other people's code is awful, and your own code from months previous counts as someone else's. With this and the festive spirit in mind, I dug up a canvas snow demo I made two years ago to see how bad my code really was.

Turns out the performance landscape has changed quite a bit, but after applying a couple of workarounds, best practices, and memory management, I got the demo running smoother than it ever did.

Ugh, I can't believe I just wrote "performance landscape". Anyway...

How does the demo work?

@tikurahul
tikurahul / expense-reports.js
Last active October 12, 2015 12:08
Bank of America (Filter Credit Card Summary with Keywords)
var transactions = $('.trans-desc-cell'),
// important -> keywords need to be uppercase (as we are not making a case insensitive comparison)
keywords = ['SEA', 'OAK', 'FRAN', 'EXPEDIA', 'ALASKA', 'TAXI', 'DELTA', 'MAX', 'PACIFIC'],
i = 0,
j = 0,
match = false,
content = null,
$t = null;
for (i = 0; i < transactions.length; i += 1) {