This file contains hidden or 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
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200 | |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { | |
return YES; | |
} | |
#endif |
This file contains hidden or 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
// Example of using a custom image as a view ? | |
customView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)]; | |
customView.image = [UIImage imageNamed:@"Foo.png"]; | |
[window addSubview: customView]; | |
[window bringSubviewToFront: customView]; | |
// Process |
This file contains hidden or 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
// From http://www.gayadesign.com/diy/snotify-easy-notifications-in-jquery/ | |
var sNotify = { | |
timeOpen: 10, //change this number to the amount of second you want the message opened | |
queue: new Array(), | |
closeQueue: new Array(), | |
addToQueue: function(msg) { |
This file contains hidden or 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
MBPro:loc_dashboard davidamcclain$ rake ts:in | |
(in /Users/davidamcclain/apps/notch8/loc_dashboard) | |
Generating Configuration to /Users/davidamcclain/apps/notch8/loc_dashboard/config/development.sphinx.conf | |
Sphinx 0.9.8-release (r1371) | |
Copyright (c) 2001-2008, Andrew Aksyonoff | |
using config file '/Users/davidamcclain/apps/notch8/loc_dashboard/config/development.sphinx.conf'... | |
indexing index 'post_core'... | |
ERROR: source 'post_core_0': unknown type 'pgsql'; skipping. | |
ERROR: index 'post_core': no valid sources configured; skipping. |
This file contains hidden or 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
SQL (0.1ms) SET client_min_messages TO 'panic' | |
SQL (0.1ms) SET client_min_messages TO 'notice' | |
Loading routes from /Users/davidamcclain/apps/notch8/loc_dashboard/vendor/plugins/community_engine/config/desert_routes.rb. | |
ThinkingSphinx::Deltas::Job Delete all (0.8ms) DELETE FROM "delayed_jobs" WHERE (handler LIKE '--- !ruby/object:ThinkingSphinx::Deltas::%') | |
SQL (0.3ms) begin | |
SQL (0.6ms) savepoint ts | |
SQL (0.0ms) PGError: ERROR: function "array_accum" already exists with same argument types | |
: CREATE AGGREGATE array_accum (anyelement) | |
( | |
sfunc = array_append, |
This file contains hidden or 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 Twitter < YqlTable | |
def grab | |
category = Category.find_by_name("Tweets") | |
terms = ["ucsd", "ucla", "csupomona"] # TODO Needs to pull from colleges | |
result_set = self.query(terms).run | |
raise result_set.inspect unless result_set["query"] && result_set["query"]["results"] | |
default_user = User.find_by_login("twitter") || User.first | |
result_set["query"]["results"]["entry"].each do |result| | |
author = User.find_by_twitter_name(result["author"]["uri"].split('/').last) || default_user | |
post = category.posts.create!(:title => result["title"], :raw_post => result["content"]["content"], :service_id => result["id"], :user => author, :published_as => 'live') |
This file contains hidden or 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
# Finds videos by tags (keywords). | |
# | |
# You can use the operators +NOT+(-) and +OR+(|). For example: | |
# find_by_tag('cats|dogs', '-rats') | |
def find_by_tag(*tags) | |
url = "videos/-/%7Bhttp%3A%2F%2Fgdata.youtube.com%2Fschemas%2F2007%2Fkeywords.cat%7D" | |
keywords = tags.map{ |t| CGI::escape(t) }.join('/') | |
request("#{url}#{keywords}") | |
end |
This file contains hidden or 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
token = ActiveSupport::SecureRandom.hex(5) |
This file contains hidden or 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 create_token | |
self.token = secure_digest(Time.now, self.id, (1..10).map{ rand.to_s }) | |
end | |
def secure_digest(*args) | |
Digest::SHA1.hexdigest(args.flatten.join('--')) | |
end |
This file contains hidden or 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
token = Digest::SHA1.hexdigest([Time.now, rand].join) |