This file contains hidden or 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 Moya | |
import SwiftyJSON | |
enum FileWebService { | |
case download(url: String, fileName: String?) | |
var localLocation: URL { | |
switch self { | |
case .download(let url, let fileName): | |
let fileKey: String = url.MD5 // use url's md5 as local file name |
This file contains hidden or 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
int read, write; | |
FILE *pcm = fopen([audioFilePath cStringUsingEncoding:1], "rb"); //source | |
fseek(pcm, 4*1024, SEEK_CUR); //skip file header | |
FILE *mp3 = fopen([mp3FilePath cStringUsingEncoding:1], "wb"); //output | |
const int PCM_SIZE = 8192; | |
const int MP3_SIZE = 8192; | |
short int pcm_buffer[PCM_SIZE*2]; | |
unsigned char mp3_buffer[MP3_SIZE]; |
This file contains hidden or 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
- (void)viewDidLoad { | |
... | |
[self.webView.scrollView addObserver:self forKeyPath:@"contentSize" options:NSKeyValueObservingOptionNew context:nil]; | |
} | |
- (void)dealloc | |
{ | |
[self.webView.scrollView removeObserver:self forKeyPath:@"contentSize" context:nil]; | |
} |
This file contains hidden or 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)application:(UIApplication *)application | |
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
// start of your application:didFinishLaunchingWithOptions | |
// !!!: Use the next line only during beta | |
// [TestFlight setDeviceIdentifier:[[UIDevice currentDevice] uniqueIdentifier]]; | |
[TestFlight takeOff:@"Insert your Application Token here"]; | |
// The rest of your application:didFinishLaunchingWithOptions method | |
// ... |
This file contains hidden or 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
local function tweetCallback( event ) | |
if ( event.action == "cancelled" ) then | |
print( "User cancelled" ) | |
else | |
print( "Thanks for the tweet!" ) | |
end | |
end | |
local options = { | |
message = "Hello Twitter world!", |
This file contains hidden or 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
local golden_ratio_conjugate = 0.618033988749895 | |
local h = math.random() | |
h = h + golden_ratio_conjugate | |
h = h % 1 | |
local r,g,b = HSVtoRGB(h, 0.5, 0.9) |
This file contains hidden or 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
function HSVtoRGB(h, s, v) | |
local r, g, b | |
local i = math.floor(h * 6) | |
local f = h * 6 - i | |
local p = v * (1 - s) | |
local q = v * (1 - f * s) | |
local t = v * (1 - (1 - f) * s) | |
local switch = i % 6 |
This file contains hidden or 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
@property (nonatomic, strong) NSSet* cats; | |
- (NSMutableSet*)catsSet; | |
@end | |
@interface _People (CoreDataGeneratedAccessors) | |
- (void)addCats:(NSSet*)value_; | |
- (void)removeCats:(NSSet*)value_; |
This file contains hidden or 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
@property (nonatomic, strong) NSNumber* age; | |
@property int16_t ageValue; | |
- (int16_t)ageValue; | |
- (void)setAgeValue:(int16_t)value_; |
This file contains hidden or 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
// DO NOT EDIT. This file is machine-generated and constantly overwritten. | |
// Make changes to People.h instead. |
NewerOlder