Skip to content

Instantly share code, notes, and snippets.

View dylanz's full-sized avatar
🐝

Dylan Stamat dylanz

🐝
View GitHub Profile
<% form_for @search do |f| %>
<ul>
<li>
<%= f.label :name_like, "Name" %>
<%= f.text_field :name_like %>
</li>
<li>
<%= f.label :category_id_equals, "Category" %>
<%= f.collection_select :category_id_equals, Category.all, :id, :name, :include_blank => true %>
</li>
<div id="fb_chart" style="width: 100%; height: 300px;"></div>
<% content_for :javascripts do %>
<script type="text/javascript">
new Highcharts.Chart({
chart: { renderTo: 'fb_chart', defaultSeriesType: 'area' },
title: { text: 'Facebook Publish to Token Rate per Day' },
@dylanz
dylanz / gist:981180
Created May 19, 2011 16:30
Dual ORM Example
@TortugaTable(tableName = "users")
@DatabaseTable(tableName = "users")
public class User {
@DatabaseField(canBeNull = false)
@TortugaField(canBeNull = false)
private String username;
@DatabaseField(canBeNull = false)
@TortugaField(canBeNull = false)
@dylanz
dylanz / gist:981165
Created May 19, 2011 16:24
Java Annotation Example
/*
* TortugaTable.java
*
* This is the Annotation class.
*
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface TortugaTable {
String tableName();
}
@DualORM(tableName = "users")
public class User {
// LOCAL ONLY
@DualORMField(remote = false)
private String fontColor;
// LOCAL AND REMOTE ONLY
@DualORMField(canBeNull = false)
private String username;
@dylanz
dylanz / gist:994371
Created May 26, 2011 23:44
TortugaParsing
####### Annotation
[sun-2:Tortuga] cat src/TortugaTable.java
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface TortugaTable {
String tableName();
}
@dylanz
dylanz / gist:994373
Created May 26, 2011 23:45
extcos-0.2b-all.jar
ClasspathScanner scanner = new ClasspathScanner();
Set<Class<?>> classes = scanner.getClasses(new ClassQuery() {
protected void query() {
select().
from("com.elc.tasklist").
returning(allImplementing(TortugaTable.class));
}
});
"" Strip all trailing whitespace in file
"" http://vim.wikia.com/wiki/Remove_unwanted_spaces
function! StripWhitespace ()
exec ':%s/ \+$//gc'
endfunction
map ,s :call StripWhitespace ()<CR>
autocmd BufWritePre * :%s/\s\+$//e
filetype off
call pathogen#runtime_append_all_bundles()
@dylanz
dylanz / code
Created November 2, 2011 19:05
iOS
-----------------------------------
@interface Product : MaaSModel {
NSString *_name;
NSInteger *_quantity;
}
Android
-----------------------------------