Skip to content

Instantly share code, notes, and snippets.

View schystz's full-sized avatar

schystz schystz

  • Philippines
View GitHub Profile
@schystz
schystz / contracts...MockRateProvider.sol
Created February 14, 2023 06:37
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
@schystz
schystz / ScaleImage
Last active August 29, 2015 14:27
Objective-C code for scaling an image and trimming the filesize down for upload
- (UIImage *)resizedImageForUpload:(UIImage *)image
{
CGSize originalSize = image.size;
CGSize targetSize = CGSizeMake(200, 200);
CGSize adjustedSize = targetSize;
// Scale image by our targetSize (200 x 200)
if (originalSize.width > targetSize.width && originalSize.width > originalSize.height) {
adjustedSize.width = originalSize.width * (targetSize.height / originalSize.height);
adjustedSize.height = targetSize.height;
@schystz
schystz / dispatch_async : global
Created February 7, 2014 10:27
ObjC GCD method templates
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^{
// code goes here
});
@schystz
schystz / FooClass.h
Last active August 29, 2015 13:56
ObjC Singleton Class Template
@interface FooClass : NSObject
+ (FooClass *)sharedInstance;
@end