Skip to content

Instantly share code, notes, and snippets.

View valeIT's full-sized avatar

Valentino Urbano valeIT

View GitHub Profile
static NSString * BCP47LanguageCodeFromISO681LanguageCode(NSString *ISO681LanguageCode) {
if ([ISO681LanguageCode isEqualToString:@"ar"]) {
return @"ar-SA";
} else if ([ISO681LanguageCode hasPrefix:@"cs"]) {
return @"cs-CZ";
} else if ([ISO681LanguageCode hasPrefix:@"da"]) {
return @"da-DK";
} else if ([ISO681LanguageCode hasPrefix:@"de"]) {
return @"de-DE";
} else if ([ISO681LanguageCode hasPrefix:@"el"]) {

This script scans your Dropbox (or any given folder) for folders stored in the ignore array and excludes them from syncing. Makes use of the official Dropbox CLI

I'm a beginner at bash, so all improvements are welcome!

#!/bin/bash

set -e

# SETTINGS
@valeIT
valeIT / preprocessor_fun.h
Created December 31, 2015 11:09 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
//: Mocks Playground
import UIKit
struct User {
}
struct PushNotificationController {
let registrar: PushNotificationRegistrar
init(registrar: PushNotificationRegistrar) {
@valeIT
valeIT / emoji_test.rb
Created February 9, 2016 20:44 — forked from holman/emoji_test.rb
A snapshot of the tests we use internally at GitHub to help edit our blog posts before they go out to everybody. For more information, take a peek at http://zachholman.com/posts/how-github-writes-blog-posts
require_relative "test_helper"
require "open-uri"
require "net/http"
class EmojiTest < Blog::Test
def test_no_emoji
posts.each do |post|
content = File.read(post)
refute_match /:[a-zA-Z0-9_]+:/, content,
@valeIT
valeIT / gist.md
Created February 10, 2016 09:40 — forked from benbalter/gist.md
Example of how to embed a Gist on GitHub Pages using Jekyll.

Here's an example of how to embed a Gist on GitHub Pages:

{% gist 5555251 %}

All you need to do is copy and paste the Gist's ID from the URL (here 5555251), and add it to a gist tag surrounded by {% and %}.

for entry in *
do
htmlmd "$entry" > "$entry.md"
done
@valeIT
valeIT / ChatKitLoader.m
Created February 23, 2016 07:43 — forked from NSExceptional/ChatKitLoader.m
A quick and dirty example of loading classes at runtime
#import <dlfcn.h> // for dlopen()
#import "MirrorKit.h" // pod 'MirrirKit'
- (NSArray<NSString *> *)chatKitClassNames {
// Load the framework, close the handle. Now you can use any ChatKit class if you know its name.
void *handle = dlopen("/System/Library/PrivateFrameworks/ChatKit.framework/ChatKit", RTLD_NOW);
dlclose(handle);
// Making use of the Objc runtime to get the classes
import Cocoa
import MASShortcut
func pow() {
let rect = NSScreen.mainScreen()?.frame
let window = NSWindow(contentRect: rect!, styleMask: NSBorderlessWindowMask, backing: .Buffered, `defer`: false)
window.backgroundColor = NSColor.clearColor()
window.opaque = false
window.alphaValue = 1
window.makeKeyAndOrderFront(NSApplication.sharedApplication())
@valeIT
valeIT / google-serp.user.js
Created May 25, 2016 16:19 — forked from nikcub/google-serp.user.js
rewrite google search result page to link directly to search result url
// Google SERP URL rewrite
//
// User script will rewrite search engine results page for Google and place real
// links to results rather than links that proxy back via google.
//
// So you go straight to the page when you click and you can copy/paste the link
//
// Install:
// 1. Download to desktop/wherever
// 2. Open Chrome extensions page (Window -> Extensions) or URL chrome://extensions