Skip to content

Instantly share code, notes, and snippets.

View moflo's full-sized avatar
🎯
Focusing

moflo moflo

🎯
Focusing
View GitHub Profile
@moflo
moflo / gist:770613
Created January 8, 2011 06:29
dismissView.m
- (void) dismissView {
//! Dismiss the veiw depending on the context, whether from the Signin view or Invitation view
if ([[UserManager sharedUserManager] getUserState] <= kFFUserStateUnregistered) { // was == kFFUserStateFirstTimeUser
fieldforcebetaAppDelegate *myApp = (fieldforcebetaAppDelegate *)[UIApplication sharedApplication].delegate;
myApp.tabBarController.selectedIndex = [myApp getTabIndexForTag:6];
[[NSNotificationCenter defaultCenter] postNotificationName:@"launchSequenceCompleted" object:self userInfo:nil];
}
@moflo
moflo / LinkedInTableCellMethod.m
Created May 14, 2011 15:21
Method for creating a UITableViewCell stuffed with LinkedIn user data
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
ToolAppImportContactCell *cell = (ToolAppImportContactCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Grab LinkedIn User Data
// LinkedInUser is a custom object container for name, LinkedInID and avatar URL
LinkedInUser *person = [self.list objectAtIndex:indexPath.row];
// Generate NSString to display in cell
cell.nameLabel.text = [NSString stringWithFormat:@"%@ %@",(person.name?person.name:@""),(person.name_last?person.name_last:@"")];
// Display the LinkedIn User's status (ie., location)
@moflo
moflo / Google OAuth2 iOS Library with LinkedIn and Twitter.m
Created May 14, 2011 16:27
Using the Google iOS OAuth2 library for both Twitter and LinkedIn
- (void)signIn:(int)socialNetworkType {
//! Method to launch authorization modal dialog for Twitter or LinkedIn
NSURL *requestURL;
NSURL *authorizeURL;
NSURL *accessURL;
NSString *scope;
if (socialNetworkType == kSignupSocialLinkedIn) {
// LinkedIn OAuth token request URLs
@moflo
moflo / ffielandingpage.html
Created September 12, 2011 23:57
IELandingPage
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="stylesheets/canvas.css" type="text/css" media="screen" />
<style type="text/css" media="screen">
#wrapper {width:100%;}
#wrapper p {width:80% !important;}
@moflo
moflo / TimeAgo.swift
Last active October 25, 2015 04:20 — forked from hansott/TimeAgo.swift
Time ago function swift ios cocoa
// MARK: - NSDate timeAgoSinceDate
// Updated for Swift2.0
func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String {
let calendar = NSCalendar.currentCalendar()
let now = NSDate()
let earliest = now.earlierDate(date)
let latest = (earliest == now) ? date : now
let components:NSDateComponents = calendar.components([.Hour, .Minute, .Day, .WeekOfYear, .Month, .Year, .Second], fromDate: earliest, toDate: latest, options: [])
@moflo
moflo / ParseORM.swift
Created March 21, 2016 15:57
ORM to map Parse PFObject to native Swift 2.0 class structure, allowing easier migration from CoreData
//
// ParseORM.swift
//
// Copyright © 2016 Mobile Flow LLC. All rights reserved.
//
import UIKit
import Parse
class ParseORM : NSObject {
@moflo
moflo / RealmORM.swift
Last active March 22, 2016 05:52
RealmORM, realm.io ORM in Swift 2.0 with simple CoreData like NSFetchController features, sorting Results<object> by a key
//
// RealmORM.swift
//
// Copyright © 2016 Mobile Flow LLC. All rights reserved.
//
import UIKit
import Realm
import RealmSwift
@moflo
moflo / MFBadgeButton
Created February 3, 2017 17:59
Swift add badge to UIButton - MFBadgeButton.swift
class MFBadgeButton : UIButton {
var badgeValue : String! = "" {
didSet {
self.layoutSubviews()
}
}
override init(frame :CGRect) {
@moflo
moflo / loremString - lorem ipsum string generator
Created April 13, 2017 16:55
JS ES6 Lorem Ipsum Random String Generator
var randomInt = (min,max) => { return Math.floor(Math.random() * (max - min + 1) + min) }
var loremString = (max) => {
let words = ['ad', 'adipisicing', 'aliqua', 'aliquip', 'amet', 'anim', 'aute', 'cillum', 'commodo', 'consectetur', 'consequat', 'culpa', 'cupidatat', 'deserunt', 'do', 'dolor', 'dolore', 'duis', 'ea', 'eiusmod', 'elit', 'enim', 'esse', 'est', 'et', 'eu', 'ex', 'excepteur', 'exercitation', 'fugiat', 'id', 'in', 'incididunt', 'ipsum', 'irure', 'labore', 'laboris', 'laborum', 'Lorem', 'magna', 'minim', 'mollit', 'nisi', 'non', 'nostrud', 'nulla', 'occaecat', 'officia', 'pariatur', 'proident', 'qui', 'quis', 'reprehenderit', 'sint', 'sit', 'sunt', 'tempor', 'ullamco', 'ut', 'velit', 'veniam', 'voluptate' ]
var sentence = ''
var count = max
while (count > 0) {
let i = randomInt(0,words.length)
let word = words[i]
sentence = count == max ? word : sentence+' '+word
count = count - 1
Verifying my Blockstack ID is secured with the address 1oVAUqjZLsvvGCT3JmPcTNGF5VQqBTrw1 https://explorer.blockstack.org/address/1oVAUqjZLsvvGCT3JmPcTNGF5VQqBTrw1