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
app.get('/auth/facebook/callback', | |
passport.authenticate('facebook', { failureRedirect: '/error', session: false }), | |
function(req, res) { | |
var token = jwt.sign(req.user, secret, { expiresInMinutes: 60*5 }); | |
res.redirect('/#jwt=' + jwt); | |
}); |
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
set -e | |
PRODUCT_PATH="${SYMROOT}/Release/Analytics.framework" | |
## Prepare the framework Folder Structure | |
mkdir -p "${PRODUCT_PATH}/Versions/A/Headers" | |
mkdir -p "${PRODUCT_PATH}/Versions/A/Resources" | |
# Link the "Current" version to "A" | |
/bin/ln -sfh A "${PRODUCT_PATH}/Versions/Current" | |
/bin/ln -sfh Versions/Current/Headers "${PRODUCT_PATH}/Headers" |
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
########################################## | |
# | |
# c.f. http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4 | |
# | |
# Version 2.7 | |
# | |
# Latest Change: | |
# - Supports iPhone 5 / iPod Touch 5 (uses Apple's workaround to lipo bug) | |
# | |
# Purpose: |
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
// | |
// PlayJsonTests.swift | |
// PlayJsonTests | |
// | |
// Created by 罗涛 on 14-6-26. | |
// Copyright (c) 2014年 罗涛. All rights reserved. | |
// | |
import XCTest | |
import PlayJson |
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 LocalContact : NSObject | |
@property (nonatomic, copy) NSString *firstName; | |
@property (nonatomic, copy) NSString *lastName; | |
@property (nonatomic, copy, readonly) NSString *fullName; | |
@property (nonatomic, copy) NSString *mobileNumber; | |
@property (nonatomic, copy) NSString *normalizedMobileNumber; | |
@property (nonatomic, copy) NSString *facebookID; |
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
HKQuantityType *weightType = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMass]; | |
// Since we are interested in retrieving the user's latest sample | |
// we sort the samples in descending order by end date | |
// and set the limit to 1 | |
// We are not filtering the data, and so the predicate is set to nil. | |
NSSortDescriptor *timeSortDescriptor = [[NSSortDescriptor alloc] initWithKey:HKSampleSortIdentifierEndDate ascending:NO]; | |
// construct the query & since we are not filtering the data the predicate is set to nil | |
HKSampleQuery *query = [[HKSampleQuery alloc] initWithSampleType:weightType predicate:nil limit:1 sortDescriptors:@[timeSortDescriptor] resultsHandler:^(HKSampleQuery *query, NSArray *results, NSError *error) { |
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
/** @jsx React.DOM */ | |
FBLoginMessageComponent = new React.createClass({ | |
render: function() { | |
var status = this.props.status; | |
var message = ''; | |
if (status === 'logged_in') { | |
message = 'You\'re already logged in.'; | |
} else if (status === 'not_logged_in') { | |
message = 'You\'re not logged in yet.'; |
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 format_time_interval(from_time, to_time) | |
seconds = (to_time - from_time).abs.round | |
minutes, seconds = seconds.divmod(60) | |
if minutes > 60 * 24 | |
" " | |
elsif minutes > 60 | |
hours, minutes = | |
" %2dh %2dm " % minutes.divmod(60) | |
else | |
" %2dm %2ds " % [minutes, seconds] |
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
# app/models/user.rb | |
def apply_omniauth(omniauth) | |
case omniauth['provider'] | |
when 'facebook' | |
self.apply_facebook(omniauth) | |
when 'twitter' | |
self.apply_twitter(omniauth) | |
end | |
authentications.build(hash_from_omniauth(omniauth)) |
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
require 'rubygems' | |
require 'test/unit' | |
require 'em-http' | |
require 'vcr' | |
VCR.config do |c| | |
c.cassette_library_dir = 'fixtures/vcr_cassettes' | |
c.http_stubbing_library = :webmock | |
end |
OlderNewer