Skip to content

Instantly share code, notes, and snippets.

View binho's full-sized avatar

Cleber Santos binho

View GitHub Profile
@myell0w
myell0w / BoldDynamicText
Last active January 2, 2016 14:09
Respect the accessibility setting "Bold Text" on iOS7, when implementing Dynamic Type with a custom font.
BOOL MTDIsBoldTextEnabled(void) {
static BOOL boldTextEnabled = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// Hack that checks if the "bold text" flag in the accessibility settings is enabled
UIFont *font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
boldTextEnabled = [font.fontName rangeOfString:@"MediumP4"].location != NSNotFound;
});
@fffabs
fffabs / Preferences.sublime-text.json
Created December 20, 2013 17:26
SublimeText 3 User Preferences
{
//
// Fonts
"font_face": "Monaco",
"font_options":"subpixel_antialias",
"font_size": 11.0,
"bold_folder_labels":true,
"line_padding_bottom":1,
"line_padding_top":1,
"word_separators": "./\\()\"'-:,.;<>~!@$%^&*|+=[]{}`~?", // Remove '#'
@hgfischer
hgfischer / benchmark+go+nginx.md
Last active January 6, 2025 09:05
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@chrismiles
chrismiles / reveal.py
Last active September 2, 2021 00:26
Lazy script to wrap Reveal lib load/start commands in one LLDB command.
""" File: reveal.py
Add to ~/.lldbinit:
command script import ~/.lldb-scripts/reveal.py
Q: Want to automatically load the Reveal lib on launch while debugging from Xcode?
A: In Xcode:
Add a Symbolic Breakpoint
Symbol: "UIApplicationMain"
Action: Debugger Command with value "reveal"
@ariok
ariok / [CoreData]EntriesBetweenDates.m
Created November 29, 2013 17:01
Get Core Data entries between a date range
+ (NSArray*)allEntriesInContext:(NSManagedObjectContext*)context fromDate:(NSDate*)fromDate toDate:(NSDate*)toDate{
// Create the request
NSFetchRequest *request = [[NSFetchRequest alloc]initWithEntityName:@"Entry"];
// Build the predicate
NSPredicate *predicate = [NSPredicate predicateWithFormat: @"date >= %@ && date <= %@ ", fromDate, toDate];
request.predicate = predicate;
// Define sorting
NSSortDescriptor *sortDesc = [NSSortDescriptor sortDescriptorWithKey:@"date" ascending:YES];
request.sortDescriptors = @[sortDesc];
@jashenson
jashenson / JSTableWithFixedHeaderViewController.m
Created November 27, 2013 23:39
Custom fixed UITableView header
// Key sections of code for this implementation are placed below
@interface JSTableWithFixedHeaderViewController ()
@property (strong, nonatomic) UIView *fixedHeaderView;
@end
@implementation JSTableWithFixedHeaderViewController
@artemstepanenko
artemstepanenko / NSOperationQueue+Completion.h
Created November 23, 2013 21:57
This NSOperationQueue's category solves very simple task. Now you can add completion callback to NSOperationQueue instance.
//
// NSOperationQueue+Completion.h
// QueueTest
//
// Created by Artem Stepanenko on 23.11.13.
// Copyright (c) 2013 Artem Stepanenko. All rights reserved.
//
typedef void (^NSOperationQueueCompletion) (void);
@pusewicz
pusewicz / mov2gif.rb
Last active December 29, 2015 01:09
Convert you QuickTime recorded screencast in the MOV and turn it into an animated GIF
#!/usr/bin/env ruby
=begin
DEPENDENCIES:
$ brew install ffmpeg
$ brew install imagemagick
=end
require 'optparse'
require 'fileutils'
@cremaschi
cremaschi / NSPredicate+Distinct.h
Created November 12, 2013 01:51
A category on the NSPredicate to add the distinct function. You can easily create a predicate that removes duplicates in an array just passing the property name you want to check.
//
// NSPredicate+Distinct.h
//
// Created by Maurizio Cremaschi on 11/11/2013.
// Copyright (c) 2013 Myfleek Ltd. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSPredicate (Distinct)
var PX = require('com.pixate.framework');
PX.styleSheetFromFilePathWithOrigin({
monitor: true,
origin: 0,
filename: '/path/to/file.css'
});
PX.styleSheetFromFilePathWithOrigin({
monitor: true,
origin: 0,
filename: '/path/to/second_file.css'