Skip to content

Instantly share code, notes, and snippets.

@CavalcanteLeo
CavalcanteLeo / states-by-countries.js
Created July 23, 2017 17:17 — forked from a-voronov/states-by-countries.js
Countries and their subdivisions based on ISO 3166-1:2013
// countries, states and subdivisions were generated relying on next documents:
// http://www.iso.org/iso/country_names_and_code_elements
// http://www.unece.org/cefact/locode/welcome.html
var countriesAndStates = [
{"Country":"AD","State":"Canillo"},
{"Country":"AD","State":"Encamp"},
{"Country":"AD","State":"La Massana"},
{"Country":"AD","State":"Ordino"},
{"Country":"AD","State":"Sant Julià de Lòria"},
@CavalcanteLeo
CavalcanteLeo / latency.markdown
Created July 23, 2017 17:15 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 http://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd">
<file original="PopcornTorrent/en.lproj/Localizable.strings" source-language="en" target-language="PT-BR" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="8.3" build-num="8E162"/>
</header>
<body>
<trans-unit id="File doesn't exist at path: %@">
<source>File doesn't exist at path: %1$@</source>
<target>Arquivo não existe no diretório: %1$@</target>
@CavalcanteLeo
CavalcanteLeo / FontAwesome.h
Created May 7, 2017 05:00 — forked from erkanyildiz/FontAwesome.h
An helper for using Font Awesome iconic font semantically, with image rendering and caching support
// erkanyildiz
// 20161026-1808+0900
//
// FontAwesome.h
#ifndef FontAwesome_h
#define FontAwesome_h
extern const struct FontAwesome
{
if (firstAsset !=nil && secondAsset!=nil) {
[activityView startAnimating];
// 1 - Create AVMutableComposition object. This object will hold your AVMutableCompositionTrack instances.
AVMutableComposition *mixComposition = [[AVMutableComposition alloc] init];
// 2 - Video track
AVMutableCompositionTrack *firstTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo
preferredTrackID:kCMPersistentTrackID_Invalid];
[firstTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, firstAsset.duration)
ofTrack:[[firstAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] atTime:kCMTimeZero error:nil];
[firstTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, secondAsset.duration)
@CavalcanteLeo
CavalcanteLeo / PT v2.xliff
Last active May 30, 2023 13:33
PopcornTimeTV translate
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 http://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd">
<file original="PopcornTime/Base.lproj/LoadingView.xib" source-language="en" target-language="Language code goes here" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="8.3" build-num="8E162"/>
</header>
<body>
<trans-unit id="9zp-GC-F8p.text">
<source>LOADING</source>
<target>CARREGANDO</target>
</trans-unit>
@CavalcanteLeo
CavalcanteLeo / zsh.md
Created January 28, 2017 04:46 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@CavalcanteLeo
CavalcanteLeo / open xcode project.zshrc
Last active November 11, 2016 17:38
Open xcode from terminal
function xc {
bold=$(tput bold)
normal=$(tput sgr0)
xcode_proj=`find . -name "*.xc*" -d 1 | sort -r | head -1`
if [[ `echo -n $xcode_proj | wc -m` == 0 ]]
then
echo "No xcworkspace/xcodeproj file found in the current directory."
else
echo "Opening ${bold}\033[1;32m$xcode_proj"
open "$xcode_proj"
@CavalcanteLeo
CavalcanteLeo / podforceupdate.sh
Created September 28, 2016 20:17 — forked from mbinna/podforceupdate.sh
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
//
// UIView+Parallax.h
//
#import <Foundation/Foundation.h>
@interface UIView (Parallax)
-(void)addBackgroundParallax:(CGFloat)strength;
-(void)addForegroundParallax:(CGFloat)strength;
-(void)removeParallax;