Skip to content

Instantly share code, notes, and snippets.

@jhanzo
jhanzo / UIView+Shimmer.swift
Created May 16, 2019 13:31
Shimmering views
//
// UIView+Shimmer.swift
// SearchFlights
//
// Created by Jessy Hanzo on 16/05/2019.
// Copyright © 2019 jho. All rights reserved.
//
import Foundation
import UIKit
@jhanzo
jhanzo / .bashrc
Created April 30, 2018 14:46 — forked from kubaceg/.bashrc
Simple bashrc with some colors and aliases
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@jhanzo
jhanzo / rpi-timemachine.md
Created February 11, 2018 10:17
Raspberry Time Machine

Gisted from https://github.com/mr-bt/raspberrypi-timemachine.

Apple Time Machine with Raspberry Pi

The following step are the ones that enable Time Machine backups with Raspberry Pi plus a bit of polishing to my taste.

1. Format the hard drive

I had a hard-drive serving as Time Machine disk. However, I couldn't mount the disk due to Apple Core Storage:

@jhanzo
jhanzo / hubot-build-bot-script
Created February 5, 2018 11:08
Hubot Builder Bot Script
# Description:
# Builder bot for sending request to Bitrise.io.
#
# Author:
# jhanzo
#
request = require 'request'
exec = require('child_process').exec
@jhanzo
jhanzo / quotes.sh
Created February 3, 2017 12:06
Disable double quotes on Mac
for d in $(defaults domains|tr -d ,);do
osascript -e "app id \"$d\""&>/dev/null||continue
defaults write $d SmartQuotes -bool false
# defaults write $d SmartDashes -bool false
# defaults write $d SmartLinks -bool false
# defaults write $d SmartCopyPaste -bool false
# defaults write $d TextReplacement -bool false
# defaults write $d CheckSpellingWhileTyping -bool false
done
@jhanzo
jhanzo / xcodebuild.sh
Created February 3, 2017 12:05 — forked from nlutsenko/yolo.sh
Fast Xcode builds
defaults write xcodebuild PBXNumberOfParallelBuildSubtasks 4
defaults write xcodebuild IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4
defaults write com.apple.xcode PBXNumberOfParallelBuildSubtasks 4
defaults write com.apple.xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4
@jhanzo
jhanzo / Type.swift
Last active September 24, 2016 11:32
Quick overview about value and reference types
import UIKit
//Let's have a look on Value and Reference Type in Swift 2.2
//What is the difference between value and reference types ?
//And what using such type implies on your code ?
//Swift blog inspiration : https://developer.apple.com/swift/blog/?id=10
//First, a short example about 'Int'
var a = 1
let b = a
@jhanzo
jhanzo / ARC.swift
Last active January 25, 2017 21:21
Quick overview about how ARC works in Swift
//Jessy HANZO
//Swift 2.2
//
//Since iOS 6, ARC brings the power to have an easier use of memory management
// **ARC**
//It provides you an intelligent management of memory
//But developper has to be watchful about how ARC works ...
//... because (Winter) Retain Cycles are coming...
//... and it is very very bad 😱
//
@jhanzo
jhanzo / Semaphore.swift
Last active February 7, 2021 15:20
Quick overview about semaphores
//In iOS, Grand Central Dispatch brings some utilities for using asynchronous tasks
//Among all functionalities, there is Semaphore which is an old school theory thought by Djikstra
//More info here : https://en.wikipedia.org/wiki/Semaphore_(programming)
//Semaphores give a control access to a common resource through concurrent tasks (done in other threads)
//NB 1: in iOS, all UI jobs has to be done ONLY in main thread, otherwise a fatal error occurs
//NB 2: before using semaphore in iOS you should always wonder if dispatch_group is not enough
//NB 3: for doing an async task in your playground you have to use semaphore concept or at least this two kinds of methods :
// XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
// XCPlaygroundPage.currentPage.finishExecution()