Skip to content

Instantly share code, notes, and snippets.

View dezinezync's full-sized avatar
🏠
Working from home

Nikhil Nigade dezinezync

🏠
Working from home
View GitHub Profile
@dezinezync
dezinezync / pref.sublime-settings
Last active October 15, 2015 15:57
Sublime Text 3 Preferred Settings
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
"font_face": "Roboto Mono",
"font_size": 13,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
- (void)reposition {
// https://developer.apple.com/library/ios/#qa/qa2010/qa1688.html
// tl;dr Only the first subview in the window receives orientation changes.
// So we apply a transform manually to rotate the view, and change the origin of the frame so
// that it remains in a top-center position for the user.
UIInterfaceOrientation orientation =
[UIApplication sharedApplication].statusBarOrientation;
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
CGAffineTransform viewTransform = CGAffineTransformIdentity;
@dezinezync
dezinezync / currencyFormatter.m
Last active August 29, 2015 13:56
currency Formatter
// Solution from http://stackoverflow.com/questions/5036971/find-locale-currency-for-iphone-programmatically/5039433#5039433
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setLocale:[NSLocale currentLocale]];
NSString *localizedMoneyString = [formatter stringFromNumber:myCurrencyNSNumberObject];
@dezinezync
dezinezync / DZLogger.h
Last active August 29, 2015 13:57
DZLogger
//
// DZLogger.h
// DZLogger
//
// Created by Nikhil Nigade on 11/12/13.
// Copyright (c) 2013-2014 Nikhil Nigade. All rights reserved.
//
// Async
//#define LogDZ(fmt,...) {\
- (NSString *)tableView:(UITableView *)tableView titleForSwipeAccessoryButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
return @"More";
}
- (void)tableView:(UITableView *)tableView swipeAccessoryButtonPushedForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"I wanted to be a pretty public API, but then time ran out and they forgot me...");
// Hide the More/Delete menu.
[self setEditing:NO animated:YES];
}
// For details, see http://mindsea.com/2012/12/18/downscaling-huge-alassets-without-fear-of-sigkill
#import <AssetsLibrary/AssetsLibrary.h>
#import <ImageIO/ImageIO.h>
// Helper methods for thumbnailForAsset:maxPixelSize:
static size_t getAssetBytesCallback(void *info, void *buffer, off_t position, size_t count) {
ALAssetRepresentation *rep = (__bridge id)info;
NSError *error = nil;
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
//
// NSHTTPCookieStorage+FreezeDry.h
//
// Created by Maciej Swic on 19/08/13.
// Modified by Dezinezync on 06/08/14.
//  
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@dezinezync
dezinezync / DZJSON.h
Last active August 29, 2015 14:05
DZJSON
//
// NSDictionary+JSON.h
// DiamConnect
//
// Created by Nikhil Nigade on 8/13/14.
// Copyright (c) 2014 agilepc-107. All rights reserved.
//
#import <Foundation/Foundation.h>
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.githubusercontent.com/dezinezync/e77945ea65b10c2677d2/raw/1353f39cdf724972e5d8c14100c8d2428358c19d/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"