This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
<?php | |
require 'routs.php'; | |
Rout::get('home', 'homeFunction'); | |
function homeFunction($params) { | |
templateManager::Render('home.tpl', $params); | |
} | |
?> |
<?php | |
require 'routs.php'; | |
Rout::get('home', 'homeFunction'); | |
function homeFunction($params) { | |
templateManager::Render('home.tpl', $params); | |
} | |
Rout::post('home', function($params){ |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
public static string MakeValidFileName( string name ) | |
{ | |
string invalidChars = Regex.Escape( new string( Path.GetInvalidFileNameChars() ) ); | |
string invalidReStr = string.Format( @"[{0}]+", invalidChars ); | |
return Regex.Replace( name, invalidReStr, "_" ); | |
} |
DefaultTreeModel model = (DefaultTreeModel)tree.getModel(); | |
DefaultMutableTreeNode root = (DefaultMutableTreeNode)model.getRoot(); | |
DefaultMutableTreeNode c1 = new DefaultMutableTreeNode("Cruce #1"); | |
c1.add(new DefaultMutableTreeNode("Child 1")); | |
root.add(c1); | |
model.reload(); |
# encoding: utf-8 | |
# Get the current battery status percentage. | |
battery_status = `acpi` | |
charge = battery_status.match(/\d*%/)[0].chop.to_i | |
# Calculate the number of charged slots. | |
total_slots = 10 | |
filled = "▸" * (charge/total_slots).ceil |
require "serialport" | |
@rfid_reader = SerialPort.new 4 # Open COM 5 | |
@arduino = SerialPort.new 2 # Open COM 3 | |
@valid_ids = ['4500B8D690BB'] | |
def readRFID | |
rfid = @rfid_reader.gets | |
rfid.strip! |
void setup () { | |
Serial.begin (9600); | |
pinMode (12, OUTPUT); | |
} | |
void serialEvent() { | |
digitalWrite(12, HIGH); | |
delay(2000); | |
digitalWrite(12, LOW); | |
Serial.read(); |
c11: | |
g++-4.6 -W -Wall -Wextra -pedantic -std=c++0x *.cc *.h |
struct punto { | |
punto(int x1, int y1) : x(x1), y(y1) {} | |
int x; | |
int y; | |
}; |