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
String username = "username_here"; | |
String password = "password_here"; | |
String posterous_url = "url_string_here"; | |
String read_data = ""; | |
void setup() { | |
try { | |
URLAuthReader.authenticated_http_request(posterous_url, username, password); | |
read_data = URLAuthReader.read_http_request(); | |
println(read_data); |
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
// this pattern returns a match that starts with "display_date":" and features a date and time. | |
// It also returns two submatches one featuring the date while the other features the time | |
String[][] date_time_string = PApplet.matchAll(currentPage, "\"display_date\":\"([\\d][\\d][\\d][\\d][/][\\d][\\d][/][\\d][\\d])[ ]([\\d][\\d][:][\\d][\\d][:][\\d][\\d])"); | |
// this pattern returns a match that starts with "body_html":" and features copy through the next | |
// instance of a quotation mark. It also returns four submatches that feature copy between the | |
// identifiers activity and location, location and people, people and description, description and the | |
// final quotation mark | |
String[][] message_bodies = PApplet.matchAll(currentPage, "\"body_html\":\".*?[Aa]ctivity:(.*?)[Ll]ocation:(.*?)[Pp]eople:(.*?)[Dd]escription:(.*?)(?=\")"); |
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
// save pin numbers to variables | |
int sensorPin = A0; | |
int ledPin1 = 2; | |
int ledPin2 = 3; | |
int ledPin3 = 4; | |
int ledPin4 = 5; | |
void setup() { | |
// define which pins are used for input and output | |
pinMode(sensorPin, INPUT); |
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
my_object = Object.new |
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
class MyClass | |
def initialize(x) | |
code to initialize stuff goes here | |
end | |
end |
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
class MyClass #class scope | |
x = “class_scope” #class scope | |
def my_method_1 #class scope | |
x = 0 #my_method_1 scope | |
(0..5).each do |n| #my_method_1 scope | |
x += x #my_method_1 scope | |
end #class scope | |
end #class scope | |
def my_method_2 #class scope | |
x = 0 #my_method_2 scope |
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
class MyClass # class instance | |
def self.class_method # class instance | |
end # class instance | |
def self.class_method_2 # class instance | |
end # class instance | |
def instance_method # object instance | |
end # object instance | |
def instance_method_2 # object instance | |
end # object instance | |
end # class instance |
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
class MyClass | |
@@class_variable #class-hierarchy variable | |
@class_instance_variable #class instance variable | |
attr_accessor :object_instance_variable #object instance attribute | |
#__variable with getter & setter | |
def self.class_method | |
local_method_variable #local method variable | |
@class_instance_variable #class instance variable | |
@@class_variable #class-hierarchy variable |
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
attr_reader : var_with_getter | |
attr_writer : var_with_setter | |
attr_accessor : var_with_setter_and_getter |
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
#VARIABLE DESCRIPTION NAMESPACE | |
#var local variable scope-based | |
#$var global variable accessible anywhere | |
#@var instance variable self-based | |
#@@var class variable class hierarchy-based | |
#Const constant accessible anywhere with proper syntax |
OlderNewer