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
#import <Foundation/Foundation.h> | |
#import <QuartzCore/QuartzCore.h> | |
@interface FTUIHelper : NSObject | |
+ (UIImage *)createImageFromColor:(UIColor *)color; | |
+ (UIColor *)colorFromHexRGB:(NSString *)inColorString | |
@end |
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
// StickyHeadersCollectionViewFlowLayout | |
// | |
// A subclass of UICollectionViewFlowLayout which has UITableView style sticky headers. | |
// | |
// This code is based on Evadne Wu's code^1, with the following changes: | |
// | |
// * Fixes a crash for sections with zero items | |
// * Adds support for UIScrollView's contentInset | |
// * Adds support for UICollectionViewFlowLayout's sectionInset | |
// |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Photos with Friends!</title> | |
<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script> | |
<script> | |
/** | |
* This is the getPhoto library | |
*/ |
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
if (firstAsset !=nil && secondAsset!=nil) { | |
[activityView startAnimating]; | |
// 1 - Create AVMutableComposition object. This object will hold your AVMutableCompositionTrack instances. | |
AVMutableComposition *mixComposition = [[AVMutableComposition alloc] init]; | |
// 2 - Video track | |
AVMutableCompositionTrack *firstTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo | |
preferredTrackID:kCMPersistentTrackID_Invalid]; | |
[firstTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, firstAsset.duration) | |
ofTrack:[[firstAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] atTime:kCMTimeZero error:nil]; | |
[firstTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, secondAsset.duration) |
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
// | |
// DetailViewController.h | |
// Sync Camera | |
// | |
// Created by kuninorif on 2014/05/22. | |
// Copyright (c) 2014年 kuninori. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
#import <AVFoundation/AVFoundation.h> |
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
AVAsset *asset = [AVAsset assetWithURL:url]; | |
CMTime duration = [asset duration]; | |
CMTime snapshot = CMTimeMake(duration.value * progress, duration.timescale); | |
AVAssetImageGenerator *generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:asset]; | |
CGImageRef imageRef = [generator copyCGImageAtTime:snapshot actualTime:nil error:nil]; | |
UIImage *thumbnail = [UIImage imageWithCGImage:imageRef]; | |
CGImageRelease(imageRef); |
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
/** | |
* Event handler to prevent richtext and linebreaks in contentEditable DIVs | |
*/ | |
$('body').on('keydown paste', 'div.editfield', function(e) { | |
var $field = $(e.currentTarget); | |
if (e.keyCode===13 && $field.hasClass('multiline')) { | |
return true; | |
} else if (e.keyCode===13 || e.type==='paste') { | |
setTimeout(function() { | |
$field.html($field.text()); |
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
//Your layout file | |
<html> | |
<head> | |
//etc | |
</head> | |
<body> | |
//Bla bla | |
<?php |
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
#!/usr/bin/env python | |
"""Delete all images in Slack that were uploaded until yesterday""" | |
import requests | |
import datetime | |
import sys | |
TOKEN = 'Put your Slack auth token here' | |
SLACK_API = 'https://slack.com/api' |
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
BOOL isDarkImage(UIImage* inputImage){ | |
BOOL isDark = FALSE; | |
CFDataRef imageData = CGDataProviderCopyData(CGImageGetDataProvider(inputImage.CGImage)); | |
const UInt8 *pixels = CFDataGetBytePtr(imageData); | |
int darkPixels = 0; | |
int length = CFDataGetLength(imageData); |
OlderNewer