Skip to content

Instantly share code, notes, and snippets.

View yanguango's full-sized avatar
🚀
Launching

Guang Yang yanguango

🚀
Launching
View GitHub Profile
Ti.App.addEventListener('openUrl', function(data){
var win = Ti.UI.createWindow({});
var newWebView = Ti.UI.createWebView({
url: data.url,
scalesPageToFit: true
});
win.add(newWebView);
Ti.UI.currentTab.open(win,{animated:true});
return false
//news.js
var webView = Ti.UI.createWebView({
top:0,
left:0,
backgroundColor:"#fff",
width:320,
url:'news.html'
});
Ti.App.addEventListener('fillNews', function(passedData)
// build/iphone/Classes/LauncherView.m#46
static const NSTimeInterval kLauncherViewEditHoldTimeInterval = 10000;
//set this const to a high number,it's the seconds you hold before you can edit
//This solution can fix the editing problem well now.
var item = Titanium.UI.createDashboardItem({
image:'../images/..',
selectedImage:'../images/..',
label:label,
canDelete:false // notice
});
var dashboard = Titanium.UI.createDashboardView({
data:data,
wobble:false // notice
var label = Ti.UI.createLabel({
text: 'Name',
top: 8
});
label.height // return 0 when no width and height setting
var label = Ti.UI.createLabel({
text: 'Blah,Blah,Blah,...',
top: 8,
width: 280,
NSString *video_url = @"http://www.youtube.com/v/2mTS5gGkK9k?fs=1&hl=en_US";
//NSData *video_data = [NSData dataWithContentsOfURL: picture_url];
MPMoviePlayerController *movieController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:video_url]];
UIImage *videoThumb = nil;
if ([movieController respondsToSelector:@selector(thumbnailImageAtTime:timeOption:)])
{
NSLog(@"===============xxxxxxxxxxx=========================");
videoThumb = [movieController thumbnailImageAtTime:(NSTimeInterval)2.0 timeOption: MPMovieTimeOptionNearestKeyFrame];
}
[videoThumb compressDownTo:200.0];
10/18/10 11:19:29 AM Razoo[66981] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath razooId not found in entity <NSSQLEntity Story id=1>'
*** Call stack at first throw:
(
0 CoreFoundation 0x027d3b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0292340e objc_exception_throw + 47
2 CoreData 0x023aae86 -[NSSQLGenerator generateSQLStatementForFetchRequest:ignoreInheritance:countOnly:] + 1254
3 CoreData 0x023aa6f0 -[NSSQLAdapter _newSelectStatementWithFetchRequest:ignoreInheritance:] + 480
4 CoreData 0x023aa501 -[NSSQLAdapter newSelectStatementWithFetchRequest:] + 49
5 CoreData 0x023aa3ae -[NSSQLCore newRowsForFetchPlan:] + 430
6 CoreData 0x023a9b09 -[NSSQLCore objectsForFetchRequest:inContext:] + 297
class CreateProductPreferences < ActiveRecord::Migration
def self.up
create_table :product_preferences, :force => true do |t|
t.integer :user_id
t.integer :product_id
t.float :preference
t.timestamps
end
end
def drm_wrapping
status = params[:status].to_s.downcase
options = {
:joins => { :applications => :last_transaction },
:order => "state_transactions.created_at desc",
:include => :product
}
direction = params[:dir]=="down" ? "desc" : "asc"
if GameApplication.aasm_states.map{|s|s.name.to_s}.include?(status)
options[:conditions] = { "game_applications.status" => status }
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-11111111-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();