Skip to content

Instantly share code, notes, and snippets.

View insidegui's full-sized avatar

Guilherme Rambo insidegui

View GitHub Profile
@insidegui
insidegui / canvas.js
Created June 6, 2011 21:35
Extensões úteis para trabalhar com canvas
// frameRate padrão será 25fps
CanvasRenderingContext2D.prototype.frameRate = 1000/25
// setFrameRate(rate)
// @rate: frame rate a ser utilizado (em quadros por segundo - fps -) (ex: 30)
CanvasRenderingContext2D.prototype.setFrameRate = function(rate)
{
// transforma o frame rate passado de quadros por segundo para ms
this.frameRate = Math.round(1000/rate);
return this.frameRate;
@jacobbubu
jacobbubu / ioslocaleidentifiers.csv
Created February 15, 2012 14:41
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 14, 2024 18:00
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@justinHowlett
justinHowlett / gist:4611988
Last active July 24, 2018 06:13
Determine if a UIImage is generally dark or generally light
BOOL isDarkImage(UIImage* inputImage){
BOOL isDark = FALSE;
CFDataRef imageData = CGDataProviderCopyData(CGImageGetDataProvider(inputImage.CGImage));
const UInt8 *pixels = CFDataGetBytePtr(imageData);
int darkPixels = 0;
int length = CFDataGetLength(imageData);
@insidegui
insidegui / php_randomdotorg.php
Created June 2, 2013 00:30
Função para obter lista de números aleatórios usando a API do site random.org. Verifica a quota com o serviço e quando necessário usa números pseudo-aleatórios como fallback.
<?php
// retorna array contendo informacoes e um array de numeros aleatórios
// num -> quantidade de numeros que deve gerar
// amount -> número máximo que pode ser gerado
// force_pseudo -> não utilizar o serviço random.org e gerar números pseudo-aleatórios
function get_random_numbers($num, $amount, $force_pseudo=false)
{
// verifica a quota do servidor com o random.org para ver se é seguro fazer uma requisição agora
$c_quota = curl_init("http://www.random.org/quota/?format=plain");
curl_setopt($c_quota, CURLOPT_RETURNTRANSFER, true);
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@zorgiepoo
zorgiepoo / gist:d751cba19a0167a589a2
Last active October 21, 2023 07:54
Example program for retrieving active URLs from Safari webkit processes.
#import <Foundation/Foundation.h>
// Useful references:
// -[SMProcess webKitActiveURLs] implementation used in Activity Monitor on 10.9 (search for it using Hopper)
// http://opensource.apple.com/source/WebKit2/WebKit2-7537.71/WebProcess/mac/WebProcessMac.mm
// https://github.com/rodionovd/RDProcess/blob/master/RDProcess.m
const CFStringRef kLSActivePageUserVisibleOriginsKey = CFSTR("LSActivePageUserVisibleOriginsKey");
const int kLSMagicConstant = -1;
@peeblesjs
peeblesjs / gist:9288f79322ed3119ece4
Last active February 11, 2016 23:31
A naive "valueForKey:" operator in Swift
operator infix --> {}
func --> (instance: Any, key: String) -> Any? {
let mirror = reflect(instance)
for index in 0 ..< mirror.count {
let (childKey, childMirror) = mirror[index]
if childKey == key {
return childMirror.value
}
}
@denisnazarov
denisnazarov / mvvm
Last active July 24, 2017 12:51
iOS ReactiveCocoa/MVVM Resources
## Collection of posts/videos I've found useful while researching mvvm
https://speakerdeck.com/jspahrsummers/code-reuse-with-mvvm
http://cocoasamurai.blogspot.com/2013/03/basic-mvvm-with-reactivecocoa.html
http://www.teehanlax.com/blog/model-view-viewmodel-for-ios/
http://martinfowler.com/eaaDev/PresentationModel.html
http://twocentstudios.com/blog/2014/06/08/on-mvvm-and-architecture-questions/
@atomicbird
atomicbird / uberfor.sh
Last active July 18, 2019 15:22
It's like Uber for howdy.
#!/bin/sh
say "Warming up the pitch engine..."
for word in `sort -R /usr/share/dict/words`
do
PITCH="It's like Uber for $word."
echo $PITCH
say $PITCH
sleep 1
done