Requirements:
If you're on OSX you're probably best off using Homebrew to install this stuff:
$ brew install node mongodb
Usage:
// iOS5 Only | |
- (void) setMediaInfo { | |
NSMutableDictionary * dict = [[NSMutableDictionary alloc] init]; | |
NSString * imName = @"imagetest.png"; // Artwork image | |
[dict setObject:NSLocalizedString(@"My Music", @"") forKey:MPMediaItemPropertyTitle]; | |
[dict setObject:NSLocalizedString(@"Myself Artist", @"") forKey:MPMediaItemPropertyArtist]; | |
MPMediaItemArtwork * mArt = [[MPMediaItemArtwork alloc] initWithImage:[UIImage imageNamed:imName]]; | |
[dict setObject:mArt forKey:MPMediaItemPropertyArtwork]; | |
[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = nil; | |
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:dict]; |
// articles per page | |
var limit = 10; | |
// pagination middleware function sets some | |
// local view variables that any view can use | |
function pagination(req, res, next) { | |
var page = parseInt(req.params.page) || 1, | |
num = page * limit; | |
db.articles.count(function(err, total) { | |
res.local("total", total); |
- (void)fetchContacts:(void (^)(NSArray *contacts))success failure:(void (^)(NSError *error))failure { | |
if (ABAddressBookRequestAccessWithCompletion) { | |
// on iOS 6 | |
CFErrorRef err; | |
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, &err); | |
ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) { | |
// ABAddressBook doesn't gaurantee execution of this block on main thread, but we want our callbacks to be | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
if (!granted) { |
var mongoose = require('mongoose'); | |
mongoose.connect('localhost/test'); | |
var Schema = mongoose.Schema; | |
var AlbumSchema = new Schema({ | |
artist: { type: Schema.Types.ObjectId, ref: 'Artist' }, | |
name: String, | |
year: Number, |
resetForm = (form) -> | |
frm_elements = form.elements | |
for element in frm_elements | |
field_type = element.type.toLowerCase(); | |
switch field_type | |
when "text", "textarea", "hidden" then element.value = "" | |
when "radio", "checkbox" then element.checked = false | |
when "select-one", "select-multi" then element.selectedIndex = -1 | |
else element.innerHTML = ""; |
<!DOCTYPE html> | |
<meta charset=utf-8> | |
<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1"> | |
<meta name=apple-mobile-web-app-capable content=yes> | |
<meta name=apple-mobile-web-app-status-bar-style content=black> | |
<title>Test fullscreen</title> | |
<style> | |
html, body { | |
margin: 0; | |
padding: 0; |
var elemScroll = null; // elemento que tem definido no css a altura desejada | |
$(function() | |
{ | |
elemScroll = $('#way'); | |
function setScrollTop() | |
{ | |
var heightDiff = $(window).height(); |
UIGraphicsBeginImageContext(self.view.frame.size); | |
[[UIImage imageNamed:@"image.png"] drawInRect:self.view.bounds]; | |
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
self.view.backgroundColor = [UIColor colorWithPatternImage:image]; |
git rm -r --cached . | |
git add . | |
git commit -m ".gitignore agora está funcionando" |