Skip to content

Instantly share code, notes, and snippets.

@sivagurut
sivagurut / gist:1185582
Created September 1, 2011 06:26 — forked from mbrochh/gist:964057
Fast Forward Your Fork
# kudos to https://github.com/drewlesueur
# stolen from here: https://github.com/blog/266-fast-forward-your-fork#comment-11535
git checkout -b upstream/master
git remote add upstream git://github.com/documentcloud/underscore.git
git pull upstream master
git checkout master // [my master branch]
git merge upstream/master
git push origin master
@retronym
retronym / just-do-it.log
Created August 19, 2012 22:10
Just Do It: TODO comments in scala/scala git-blamed on commits between 2.9.2 and 2.10-0-SNAPSHOT
========================================
Adriaan Moors
========================================
= src/compiler/scala/tools/nsc/ast/TreeGen.scala
1dbcbd5 2012-02-17 75 // TODO: would be so much nicer if we would know during match-translation (i.e., type checking)
= src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
2890714 2012-04-24 536 // TODO: clean this up -- there is too much information packked into makePatDef's `pat` argument
= src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
a57ac60 2012-02-13 1107 var ctx1 = genLoad(selector, ctx, INT) // TODO: Java 7 allows strings in switches (so, don't assume INT and don't convert the literals using intValue)
= src/compiler/scala/tools/nsc/transform/Erasure.scala
object Trimmed {
val Stop = ".*\\b(a|an|the|to|of|as|in|with|for)$".r
val Fine = "(.+\\.)$".r
val Punc = "(.+)[,;:]$".r
}
class Trimmed(size: Int) {
def unapply(s: String) = s.replaceAll("\\s+", " ") match {
case res if res.size <= size => Some(res)
case res => res.split(' ').inits.map(_ mkString " ").flatMap {
@retronym
retronym / namespace-management.md
Last active December 21, 2015 20:49
namespace-management.md

Namespace Management (DRAFT)

Purpose

This document describes the guidelines for managing two important namespaces: the package scala._, and the Maven group org.scala-lang.

These questions become more important as we modularize the distribution, and as we publish new modules (such as ScalaJS, scala-async, scala-pickling.)

@johnynek
johnynek / JsonInjectionExample
Last active December 23, 2015 18:09
Json injection example with case classes to Maps.
scala> case class Wrapped(x: Int, y: Long)
defined class Wrapped
scala> import com.twitter.bijection._
import com.twitter.bijection._
scala> import com.twitter.bijection.json._
import com.twitter.bijection.json._
scala> import com.twitter.bijection.json.JsonNodeInjection._
@gontard
gontard / FXMorphing.java
Last active February 27, 2016 01:24
JFX 2 : morphing 2D Transition. The FXMorphing class is an application thats demonstrate how to use the Morphing2D Transition.
import javafx.animation.Interpolator;
import javafx.animation.Transition;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.shape.Ellipse;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Shape;
import javafx.stage.Stage;
import javafx.util.Duration;
@andrewconner
andrewconner / FutureGoodies.scala
Last active May 4, 2016 11:34
SafeFuture, TimeoutFuture, CancelableFuture implementations. See https://eng.42go.com/future-safefuture-timeout-cancelable for further explanation.Thanks to @bretthoerner for spotting an error!
/* We've run into a few common pitfalls when dealing with Futures in Scala, so I wrote these three helpful
* classes to give some baked-in functionality.
*
* I'd love to hear about other helpers you're using like these, or if you have improvement suggestions.
* github@andrewconner.org / @connerdelights
*/
import scala.concurrent.{ExecutionContext, CanAwait, Awaitable, Future, Promise}
import scala.concurrent.duration.Duration
import scala.util.Try
@HKLF4
HKLF4 / audio_tag.rb
Created August 27, 2012 09:54
Octopress HTML5 Audio Tag
# Title:
# Octopress HTML5 Audio Tag
# http://antoncherkasov.me/projects/octopress-plugins
# Author:
# Anton Cherkasov
# http://antoncherkasov.me
# antoncherkasov@me.com
# Syntax:
# {% audio url/to/mp3 %}
# {% audio url/to/mp3 url/to/ogg %}
@drexin
drexin / Macros.scala
Last active October 27, 2016 09:41
macros to get current file and line, inspired by ruby's __FILE__ and __LINE__
import java.io.File
import language.experimental.macros
import scala.reflect.macros.Context
object Macros {
def LINE: Int = macro lineImpl
def lineImpl(c: Context): c.Expr[Int] = {
import c.universe._
@tabletick
tabletick / audio_tag.rb
Created September 6, 2012 10:08
Audio/MP3 Plugin for Octopress
# Title: MP3 tag for Jekyll
# Authors: Devin Weaver, Daniel Roos (youtube changes)
# Description: Allows mp3 tag to include mp3 files embedded into the post.
# It uses the player 'audio.js' from http://kolber.github.com/audiojs/
#
# Install the plugin according to the manuel of the author by adding the necessary lines to the head-template
# and adding the files into the right directories.
#
# Please read my [blog post about it][2].
#