This file contains 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
#!/bin/bash | |
rm libs/*.jar | |
rm -rf tools | |
echo "========================================" | |
echo "PULLING GDX LIBRARIES" | |
echo "========================================" | |
curl -o libs/gdx.jar "http://libgdx.badlogicgames.com/nightlies/dist/gdx.jar" | |
curl -o libs/gdx-sources.jar "http://libgdx.badlogicgames.com/nightlies/dist/sources/gdx-sources.jar" |
This file contains 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
#!/bin/bash | |
/usr/libexec/java_home -V 2>&1 | grep -E "\d.\d.\d_\d\d" | cut -d , -f 1 | colrm 1 4 | grep -v Home |
This file contains 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<!-- Change MYAPPLICATION to yor project name --> | |
<project basedir="." default="run" name="MYAPPICATION"> | |
<property environment="env"/> | |
<property name="debuglevel" value="source,lines,vars"/> | |
<property name="target" value="1.6"/> | |
<property name="source" value="1.6"/> | |
<!-- Change MYAPPLICATION to yor project name --> |
This file contains 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
#!/bin/bash | |
if [ $# -lt 1 ] | |
then | |
echo "Usage : jvm use [1.6|1.7]" | |
echo " jvm ls" | |
exit | |
fi | |
case $1 in |
This file contains 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
# Outputs text with the specified format | |
# | |
# @param [String] text what you want to say | |
# @param [Hash] options | |
# | |
# @return [void] | |
def say text, options={} | |
color = options[:color] || :white | |
weight = options[:weight] || :normal |
This file contains 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
subquery = Article.where(:person_id => 1).select(:id).order{id.desc}.limit(1) | |
Person.where(:id => 1).select{[id, name, subquery.as('last_article_id')]}.to_sql | |
=> SELECT "people"."id", "people"."name", | |
( | |
SELECT "articles"."id" FROM "articles" | |
WHERE "articles"."person_id" = 1 | |
ORDER BY "articles"."id" DESC LIMIT 1 | |
) last_article_id | |
FROM "people" WHERE "people"."id" = 1 |
This file contains 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
public class InputTask implements Runnable { | |
private final ImmutableBag<Entity> entities; | |
public InputTask(ImmutableBag<Entity> entities) { | |
this.entities = entities; | |
} | |
@Override | |
public void run() { | |
for (int i = 0; i < entities.size(); i++) update(entities.get(i)); | |
} |
This file contains 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
public class SomeUtilityClass { | |
private static final ThreadPoolExecutor threads = new ThreadPoolExecutor( | |
Runtime.getRuntime().availableProcessors(), 10, | |
10, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(100, true)); | |
public static void scheduleTask(Runnable runnable) { | |
threads.execute(runnable); | |
} | |
} |
This file contains 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 net.warmwaffles; | |
import java.util.concurrent.LinkedBlockingQueue; | |
import java.util.concurrent.ThreadPoolExecutor; | |
import java.util.concurrent.TimeUnit; | |
public class Scheduler { | |
private static Scheduler instance; | |
private ThreadPoolExecutor executor; |
This file contains 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
p = lambda do | |
{:default => <<-DEFAULT_SQL, :mysql => <<-MYSQL} | |
UPDATE users SET item_count = item_count + 1 | |
WHERE id IN (SELECT user_id FROM buckets WHERE id = NEW.bucket_id) | |
DEFAULT_SQL | |
UPDATE users, buckets SET item_count = item_count + 1 | |
WHERE users.id = user_id AND buckets.id = NEW.bucket_id |