Skip to content

Instantly share code, notes, and snippets.

View iksnae's full-sized avatar

K Mills iksnae

View GitHub Profile
@iksnae
iksnae / gist:6072338
Last active December 20, 2015 04:39
extending Array with a move( from, to ) function to reorder content in place
Array.prototype.move = function (from, to) {
this.splice(to, 0, this.splice(from, 1)[0]);
};
@iksnae
iksnae / gist:6073444
Created July 24, 2013 19:00
mb shifting
var moodboards_order_array = [];
function onMoveMoodboardUp(mb_index)
{
switch(getMoodboardFilteringMode())
{
case true:
// shift filtered
shiftMoodBoardsFiltered(mb_index,-1);
break;
@iksnae
iksnae / gist:b64437d5e7c2a7e20397
Created May 2, 2014 20:57
App Store View Controller
SKStoreProductViewController *productVC = [[SKStoreProductViewController alloc]init];
[productVC setDelegate:self];
NSDictionary *productParameters = @{ SKStoreProductParameterITunesItemIdentifier : @"708802884" };
[productVC loadProductWithParameters:productParameters completionBlock:^(BOOL result, NSError *error) {
//
[self dismissViewControllerAnimated:NO completion:nil];
if(error)
{
[[[UIAlertView alloc] initWithTitle:[error localizedDescription]
@iksnae
iksnae / gist:84f7a562c122b2511c6e
Created May 5, 2014 18:30
UINavigationController changeViewController:animated
@interface UINavigationController (Extras)
- (void)changeViewController:(UIViewController *)viewController animated:(BOOL)animated;
@end
@implementation UINavigationController (Extras)
- (void)changeViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if ([self.childViewControllers containsObject:viewController]) {
@iksnae
iksnae / gist:0e112060142da0c8dfc07b92e760b836
Created June 9, 2016 20:24
demo flask throwing error
docker-compose up --build
Building website
Step 1 : FROM python:2.7-slim
---> 035cf774b0b8
Step 2 : MAINTAINER Nick Janetakis <[email protected]>
---> Using cache
---> 0554b77eccd4
Step 3 : ENV INSTALL_PATH /snakeeyes
---> Using cache
---> 97e63342861a
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
swift package init --type library
class ImageCache {
static let shared = ImageCache()
let cache: NSCache<NSString,UIImage> = NSCache()
func addImage(key:String, image:UIImage) {
self.cache.setObject(image, forKey: key)
}
func getImage(key:String) -> UIImage? {
extension UIImageView {
public func cachedImage(withURL url_string:String){
if let cached = ImageCache.shared.getImage(key: url_string) {
self.image = cached
}else{
guard let url = NSURL(string: url_string) else { return }
ImageCache.shared.fetchImage(url: url, callback: { (image) in
NSOperationQueue.main().addOperation({
self.image = image
})
var https = require('https');
const endpoint = "https://spreadsheets.google.com/feeds/list/1DikXO7iDW8PjSE7GBIO-QJdVSXE7yiTuQ0MBwLBoGFM/od6/public/values?alt=json";
https.get(endpoint, function(res) {
var body = '';
res.setEncoding('utf8');
res.on('data', function(chunk) {
body += chunk;
});