Skip to content

Instantly share code, notes, and snippets.

View nacho4d's full-sized avatar

Guillermo Ignacio Enriquez Gutierrez nacho4d

View GitHub Profile
@nacho4d
nacho4d / limit
Created November 15, 2011 06:51
[Shell] Use ipfw to limit internet speed
#!/bin/bash
# configuration
#host1 is for metadata, host2 is for data
host1="api.dropbox.com"
host2="api-content.dropbox.com"
# usage
if [ "$*" == "" ]; then
echo "usage: $0 [restore|off|fast|medium|slow]"
@nacho4d
nacho4d / UniversalCharsetDetectorResults.md
Created June 5, 2012 11:10
Universal Charset Detector Results

Universal Charset Detector:

Possible Encodings:

  • "ibm850"

  • "ASCII"

  • "UTF-8"

  • "X-ISO-10646-UCS-4-3412"

  • "X-ISO-10646-UCS-4-2143"

anonymous
anonymous / UIImage+RoundedCorners.m
Created October 25, 2013 06:18
UIImage with rounded corners
// This could be done using CALayer cornerRadius property
// This is an example of how would be done without that :-)
@interface UIImage (RoundedCorners)
- (UIImage *)roundedImageWithCornerRadius:(CGFloat)cornerRadius;
@end
@implementation UIImage (RoundedCorners)
@jakemarsh
jakemarsh / reset_simulator.applescript
Created January 20, 2012 14:57
Simple Applescript that can be run from the command line to programmatically reset the iOS simulator.
tell application "iPhone Simulator"
activate
end tell
tell application "System Events"
tell process "iPhone Simulator"
tell menu bar 1
tell menu bar item "iOS Simulator"
tell menu "iOS Simulator"
click menu item "Reset Content and Settings…"
@aki-null
aki-null / gist:1497649
Created December 19, 2011 15:23
Core Text APIを使用した際に起こる行間の問題の回避
NSFont *normalFont = [NSFont systemFontOfSize:12];
CGRect renderFrame = CGRectMake(0, 0, 300, 50); // box to render the text into
static NSLayoutManager *layMan = nil;
if (!layMan) {
layMan = [NSLayoutManager new];
}
CGFloat lineHeight = [layMan defaultLineHeightForFont:normalFont]; // calculate the expected height of a line
NSDictionary *attrDict = [NSDictionary dictionaryWithObject:normalFont andKey:NSFontAttributeName];
@ryanmaxwell
ryanmaxwell / ryan-objc.cfg
Last active June 26, 2019 16:41
Objective-C Uncrustify Config
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.2 (140)
#
# Alignment
# ---------
## Alignment
@tszming
tszming / objc.cfg
Created April 25, 2011 18:39
My uncrustify config file for objective-c
#
# uncrustify config file for objective-c and objective-c++
#
indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs
output_tab_size = 4 # new tab size
indent_columns = output_tab_size
indent_label = 2 # pos: absolute col, neg: relative column
indent_align_assign = FALSE
//
// Punycode.swift
//
// Created by Mike Kasianowicz on 9/7/15.
// Copyright © 2015 Mike Kasianowicz. All rights reserved.
//
import Foundation
public class Punycode {
@ansonparker
ansonparker / gist:1228449
Created September 20, 2011 05:48
Lossless FLV to MP4 conversion
Open command prompt (Terminal) and run:
ffmpeg -i "filename.flv" -vcodec copy -acodec copy "filename.mp4"
This will copy video track and audio track from filename.flv to filename.mp4. The operation is lossless (there is no quality loss).
@Ponyboy47
Ponyboy47 / Logger.swift
Created September 10, 2018 22:15
Proof of Concept of a Swift Logger
import Foundation
import Dispatch
// Special queue for flushing the logs
private let loggingQueue = DispatchQueue(label: "com.logging.queue", qos: .utility)
// The application-wide logger object
public var logger: Logger = GlobalLogger.global
// A global logger which flushes data using the loggingQueue