Skip to content

Instantly share code, notes, and snippets.

@kevinold
kevinold / App.js
Last active October 3, 2021 20:34
Left and Right Drawers with React Navigation
import React, { Component } from 'react';
import { Text } from 'react-native';
import { DrawerNavigator } from 'react-navigation';
const ContentScreen = ({ navigation }) => (
<Text>Content Hello World</Text>
);
const LeftDrawerScreen = ({ navigation }) => (
<Text>Left Drawer</Text>
@tanftw
tanftw / weather.php
Last active November 10, 2016 18:42
Weather Intended Actions
<?php
// Matches with 'weather + anything'
$bot->answer('weather%', function ($bot, $user_id, $input)
{
$city = ltrim($input, 'weather');
// Pseudo code to get weather from database
$weather = DB::getWeather($city);
@prrane
prrane / ReadAddressBook.swift
Created September 4, 2014 05:34
Swift: Get contact emails from AddressBook
// based on : http://stackoverflow.com/questions/24752627/accessing-ios-address-book-with-swift-array-count-of-zero
// http://stackoverflow.com/questions/24752627/accessing-ios-address-book-with-swift-array-count-of-zero
class func extractABAddressBookRef(abRef: Unmanaged<ABAddressBookRef>!) -> ABAddressBookRef? {
if let ab = abRef {
return Unmanaged<NSObject>.fromOpaque(ab.toOpaque()).takeUnretainedValue()
}
return nil
}
@subfuzion
subfuzion / mongoose-cheatsheet.md
Created February 26, 2014 19:03
mongoose cheatsheet

Definitely not comprehensive. This is meant to be a basic memory aid with links to get more details. I'll add to it over time.

Install

$ npm install mongoose --save

Connect

const mongoose = require('mongoose');
@ChrisRicca
ChrisRicca / twitter.m
Created February 21, 2014 21:46 — forked from vhbit/twitter.m
- (BOOL)openTwitterClientForUserName:(NSString*)userName {
NSArray *urls = [NSArray arrayWithObjects:
@"twitter:@{username}", // Twitter
@"tweetbot:///user_profile/{username}", // TweetBot
@"echofon:///user_timeline?{username}", // Echofon
@"twit:///user?screen_name={username}", // Twittelator Pro
@"x-seesmic://twitter_profile?twitter_screen_name={username}", // Seesmic
@"x-birdfeed://user?screen_name={username}", // Birdfeed
@"tweetings:///user?screen_name={username}", // Tweetings
@"simplytweet:?link=http://twitter.com/{username}", // SimplyTweet
@billyohgren
billyohgren / UILabel+ContentSize.h
Last active April 20, 2020 13:04
Calculate the actual size of the content inside a UILabel
#import <UIKit/UIKit.h>
@interface UILabel (ContentSize)
- (CGSize)contentSize;
@end
@FokkeZB
FokkeZB / README.md
Created September 20, 2013 09:38
URL schemes for iOS and Android (2/2)
@bobmoff
bobmoff / UIView+ModifyFrame.h
Last active November 27, 2021 06:58
Simple but really useful category on UIView that makes modifying the frame NOT hellish. Published under WTFPL [http://www.wtfpl.net/]. Usage example can be found in the comments
/*
Before:
CGRect frame = myView.frame;
frame.origin.x = newX;
myView.frame = frame;
After:
myView.x = newX;
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@lamprosg
lamprosg / main.php
Created July 22, 2012 21:11
Resize image on the fly in PHP
<?php
//How to use it
//Just call timthumb.php with appropriate arguments, For example:
<img src="/script/timthumb.php?src=/some/path/myimage.png&w=100&h=80" alt="resized image" />
/* http://viralpatel.net/blogs/resize-image-dynamically-php/ */
?>