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
/* | |
* Copyright (c) 2010 Noah Sloan <http://noahsloan.com> | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |
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 com.noahsloan.grails.dwr; | |
import java.lang.reflect.Field; | |
import java.lang.reflect.Method; | |
import java.util.Collection; | |
import java.util.Map; | |
import org.directwebremoting.convert.BeanConverter; | |
import org.directwebremoting.convert.CollectionConverter; | |
import org.directwebremoting.extend.InboundContext; |
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
// Church Encoding in Groovy | |
// Translated from http://meta-meta.blogspot.com/2007/06/church-code.html | |
def partial(c) { | |
return { a -> { b -> c(a,b) } } | |
} | |
T = partial { a,b -> a } | |
F = partial { a,b -> b } | |
def toBool(f) { |
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
// wait until the user pauses at least 500ms before doing validation | |
var timer; | |
$('.whatever').keypress(function() { | |
if(timer) clearTimeout(timer); | |
timer = setTimeout(validate,500); | |
}); |
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
import android.database.Cursor; | |
import android.database.sqlite.SQLiteDatabase; | |
/** | |
* Dear Android, why do I have to write this class myself? Is this to discourage SQL use? | |
*/ | |
public class QueryBuilder { | |
private String[] columns; | |
private boolean distinct; | |
private String table; |
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
<activity android:name=".MyAppRegisterAccount" | |
android:label="@string/addAccount" > | |
<intent-filter> | |
<action android:name="android.intent.action.VIEW"/> | |
<category android:name="android.intent.category.DEFAULT"/> | |
<category android:name="android.intent.category.BROWSABLE"/> | |
<data android:scheme="myApp" /> | |
</intent-filter> | |
</activity> |
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
Intent intent = new Intent(Intent.ACTION_VIEW); | |
intent.setData(Uri.parse( | |
"http://gowalla.com/api/oauth/new?redirect_uri=myApp://register&client_id=12345")); | |
startActivity(intent); |
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
<div id="results"> | |
<forEach in="${results}"> | |
<div class="result">${result}</div> | |
</forEach> | |
</div> |
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
$('#results').load('/renderResults?page=2'); |
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
<div class="product" > | |
<g:link action="show" id="${productInstance.id}"> | |
<h3> | |
${productInstance.name} | |
(${productInstance.id}) | |
</h3> | |
</g:link> | |
<div class="image"> |
OlderNewer