Skip to content

Instantly share code, notes, and snippets.

/*
* jQuery placeholder Plugin
* version: 0.1
* @requires: jQuery v1.4.1 or later, Modernizr, and jquery livequery plugin
*
* http://docs.jquery.com/Plugins/livequery
*
* To use: When you write your input tags, include a title and placeholder attribute as
* well as a placeholder class. Also include styling for the hasPlaceholder class.
*
@axiak
axiak / gist:949670
Created April 30, 2011 13:33
jquery.placeholder.js
/*
* jQuery placeholder Plugin
* version: 0.1
* @requires: jQuery v1.4.1 or later, Modernizr, and jquery livequery plugin
*
* http://docs.jquery.com/Plugins/livequery
*
* To use: When you write your input tags, include a title and placeholder attribute as
* well as a placeholder class. Also include styling for the hasPlaceholder class.
*
@axiak
axiak / gist:963879
Created May 10, 2011 03:58
Dumper.java
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
public class Dumper {
private static final Class[] printtableClasses = new Class[]{
String.class, Integer.class, Float.class, Double.class,
BigDecimal.class, Character.class, Byte.class,
class MyJobRunner extends Job<List<Something>> {
// ...
public List<Something> doJobWithResult() throws Exception {
// some preparation logic
List<List<Something>> = await(F.Promise.waitAll(firstJob.now(), secondJob.now(), ...));
// some merging logic...
return ...;
}
sub js_encode {
my $text = shift;
my @js_entities = ("\\", "\\\\", '&', '\&', '"', '\"', '<', '\<', '>', '\>', "'", "\'");
# This was what was there before:
#my @js_entities = ('&', '\&', '"', '\"', '<', '\<', '>', '\>', "'", "\'");
my ($char, $js_char);
for (my $i = 0; $i < scalar @js_entities; $i = $i + 2) {
$text =~ s/$js_entities[$i]/$js_entities[$i+1]/g;
}
return $text;
requireLogin = (method) ->
(req, res) ->
if loggedIn
method(req, res)
else
# blargh!
class MyHandler
getUser: requireLogin (req, res) ->
name := "MyProject"
version := "0.1"
scalaVersion := "2.9.1"
scalaHome := Some(file("/opt/scala"))
scalaSource in Compile <<= baseDirectory(_ / "project")
./project
./project/Simulator.scala
./.idea_modules
./.idea_modules/default-309e8b.iml
./.idea_modules/project.iml
./run.sh
./.history
./.idea
./build.sbt
[info] Set current project to default-5f8541 (in build file:/home/axiak/.sbt/plugins/)
[info] Compiling 2 Scala sources to /home/axiak/.../project/target/scala_2.8.1/classes...
[error] /home/axiak/.../project/Build.scala:13: not found: value ShellPrompt
[error] shellPrompt := ShellPrompt.buildShellPrompt
[error] ^
[error] /home/axiak/.../project/Simulator.scala:26: not found: type App
[error] object Simulator extends App {
[error] ^
[error] /home/axiak/.../Simulator.scala:27: not found: value args
[error] if (args.isEmpty) {
new Iterator[DayRecord] {
var numRecords = 0
var nextRecord = actualNext()
def next() = nextRecord match {
case Some(x) => {
nextRecord = actualNext()
x
}
case _ => throw new NoSuchElementException()