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
-(void)checkAnswer:(int)answer { | |
if(rightAnswer==answer) | |
{ | |
//AudioServicesPlaySystemSound(_tweetSound); | |
score++; | |
} | |
else { | |
//AudioServicesPlaySystemSound(_barkSound); | |
} | |
[self updateScore]; |
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
-(NSArray*) openDatabaseWithSql:(NSString*)statement { | |
// Open the database. The database was prepared outside the application. | |
if (sqlite3_open([self.dbPath UTF8String], &database) == SQLITE_OK) { | |
// Get the primary key for all books. | |
const char *sql = [statement cStringUsingEncoding:NSUTF8StringEncoding]; | |
sqlite3_stmt *statement; | |
// Preparing a statement compiles the SQL query into a byte-code program in the SQLite library. | |
// The third parameter is either the length of the SQL string or -1 to read up to the first null terminator. | |
if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) { |
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
def initialize(input) | |
@data = Hash.new { |h,k| h[k] = { }} | |
input.each do |line| | |
line.chomp! | |
next if line =~ /^(Provider|$)/ | |
tokens = line.split(/\t/) | |
country = tokens[12] | |
count = tokens[7].to_i | |
@data[country][:date] = Date.parse(tokens[9]) | |
type = tokens[6] |
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
load_data_into_table:function (page_id, category_id, on_success) { | |
app.show_spinner(); | |
var aWhiteWheel = new activityIndicator($('#WhiteWheel')); | |
aWhiteWheel.start(); | |
var url_to_use = serverHost+"/items/"+category_id; | |
if (category_id==null) { | |
url_to_use = serverHost+"/items"; | |
}; | |
$.ajax({ |
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
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<style type="text/css" media="screen"> | |
/* portrait mode */ | |
@media screen and (max-width: 320px) { | |
#rotateme { | |
background-color: #ff2900; | |
width: 100px; | |
height: 200px; | |
border: 2px solid #000; |
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
<html> | |
<head> | |
<style> | |
div {left: 20px; top: 50px; width: 120px; height: 20px; border: thin solid black; overflow: hidden; text-overflow: ellipsis } | |
.ellipsis | |
{ | |
vertical-align: text-bottom; | |
float: right; |
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
// interface file | |
@interface MHHistory : NSObject | |
{ | |
NSMutableArray *_historyArray; | |
} | |
@property (nonatomic, retain) NSMutableArray *historyArray; |
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
on adding folder items to this_folder after receiving added_items | |
property movieExtList : {"mov", "mpg", "mp4"} | |
try | |
tell application "Finder" | |
--get the name of the folder | |
set the folder_name to the name of this_folder |
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
# Prep: npm install whatismyip geoip-lite openweathermap | |
# Usage: coffee weather.coffee hostname | |
# Provide hostname as argument and weather is looked up for that hostname. | |
# Skip argument and YOUR location is used (if found) | |
# Patched together one cold evening by Christian Hedin, github.com/ciryon | |
# | |
dns = require 'dns' | |
ip = require 'whatismyip' | |
geoip = require 'geoip-lite' |
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
extension NSDate { | |
func timeAgoInWords() -> String { | |
let secondsDiff = self.timeIntervalSinceNow | |
if secondsDiff < 60 { | |
return "JUST_NOW".localized | |
} | |
if secondsDiff < 3600 { | |
let minutesAgo = secondsDiff / 60 | |
return "X_MINS_AGO".localizedStringWithVariables(minutesAgo) |
OlderNewer