Skip to content

Instantly share code, notes, and snippets.

form_remote_tag(:url => add_keyword_path(keyword), :html => {:style => 'display:inline'}) do
"hello"
#text_field_tag('keyword', nil, :size => 20)
#submit_tag('Submit') +
#link_to_function('Cancel', "$('#{id}').removeClassName('UIRightButton-selected');$('#{id}').addClassName('UIRightButton');$(this.up(1)).hide();")
end
# current
Formula.counta(:r => -People.count, :r2 => -1)
# new
Formula.counta(:rows => -People.count..-1)
# -or-
Formula.counta(:row => [-People.count, -1])
# -or-
Formula.counta(-People.count..-1, nil)
Formula.counta(nil, -ParentItems..-1)
# In the first case you might be able to drop the nil at the end
# how should we handle when columns are 0 (which happen quite a bit)?
# I was thinking like this
Formula.counta(:rows => 20..30)
# => R[20]C:R[30]C
# Obviously there is a trade off on readability and code density
# So the question, I guess, is requiring :col in the case of :rows required or can it be omitted?
class Tokenizer {
public:
Tokenizer();
};
// inside Program.h
class Program {
public:
Program();
1 class CreateSurveyResponseAlternatives < ActiveRecord::Migration
2 def self.up
3 create_table :survey_response_alternatives do |t|
4 t.string :name
5 t.string :value
6 t.integer :position
7 t.references :survey_item
8 end
9
10 #SurveyResponseAlternative.reset_column_information
scene->pList = (polygon_t *)malloc(scene->nPolygons * sizeof(polygon_t));
for(int i = 0; i < scene->nPolygons; i++)
{
polygon_t poly;
scene->pList[i] = poly;
loadPolygon(&file, &scene->pList[i], scene->vList);
@silasb
silasb / led.c
Created September 27, 2010 03:55
//TOUCH SENSING BETA - LED TURNS ON WHEN LIGHT IS PRESENT
//BY: RICARDO DE LEMOS 1/17/2007
int led1 = 13;
int cath = 2; // negative
int ando = 3; // positive
void setup()
{
pinMode(led1, OUTPUT);
pinMode(cath, OUTPUT);
require 'date'
def print_thursday(d1, d2)
d1 += 1 while (d1.wday != 4)
d1.step(d2, 7) do |date|
puts "#{Date::MONTHNAMES[date.mon]} #{date.day}"
end
end
print_thursdays(Date.today, Date::civil(2011, 5, 23))
import malachi
conn = malachi.connect('127.0.0.1', 8000)
#connect to AIM service
aim = conn.service('aim', my_user_name, my_pass)
a_list = aim.get_buddy_list()
aim.send_message(a_list[0], "hello")
#connect to irc service
@silasb
silasb / gist:939565
Created April 24, 2011 14:09
Why doesn't printer work?
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtWebKit import *
class Test(QWidget):
def __init__(self, parent=None):
super(Test, self).__init__(parent)
vbox = QVBoxLayout()