Skip to content

Instantly share code, notes, and snippets.

View fousa's full-sized avatar

Jelle Vandebeeck fousa

View GitHub Profile
@fousa
fousa / pre-commit
Last active July 15, 2021 07:43
pre-commit formatting
#!/bin/bash
# Check if the stashed files with swiftformat before commiting.
#
# Installation:
# - Run the following command from your git root:
# `curl https://gist.githubusercontent.com/fousa/bf38ab0d3e0a0cd5ce1752c5c4932038/raw/ce9d02c9038e9f9b4b542a65f16fb94fb2ab352a/pre-commit > .git/hooks/pre-commit`
# - Set hook as executable:
# `chmod +x .git/hooks/pre-commit`
@fousa
fousa / FairPlayer.swift
Last active June 1, 2023 12:28
Integrate HLS with FairPlay.
class FairPlayer: AVPlayer {
private let queue = DispatchQueue(label: "com.icapps.fairplay.queue")
func play(asset: AVURLAsset) {
// Set the resource loader delegate to this class. The `resourceLoader`'s delegate will be
// triggered when FairPlay handling is required.
asset.resourceLoader.setDelegate(self, queue: queue)
// Load the asset in the player.
@fousa
fousa / .swiftlint.yml
Created January 3, 2017 13:44
Our current Swiftlint configuration file.
included:
- Application Target Folder
- Tests Target Folder
disabled_rules:
- line_length
- trailing_whitespace
- function_body_length
- type_body_length
- file_length
- valid_docs
@fousa
fousa / get_uuid_from_dsym.rb
Created January 29, 2015 08:39
Get the UUID from your dSYM.
#! /usr/bin/ruby
# You should pass the dSYM path from the dSYM file you
# want to lookup the UUID from.
unless ARGV.count == 1
puts '!!! You should pass the dSYM path in order to lookup the UUID.'
exit
end
dsym_path = ARGV.first
@fousa
fousa / remove_itunes.sh
Last active August 29, 2015 14:01
Stop iTunes from launching when connecting a bluetooth headset
echo
echo "*************************************************************************"
echo "** **"
echo "** Stop iTunes from launching when connecting a bluetooth headset. **"
echo "** **"
echo "*************************************************************************"
echo "** **"
echo "** -> Renaming the iTunes application to iMelodies. **"
sudo mv /Applications/iTunes.app /Applications/iMelodies.app
#!/bin/sh
echo "Testing"
@fousa
fousa / deploy.rb
Last active January 29, 2016 18:08
Deploy with mina on DigitalOcean server.
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
require 'mina_sidekiq/tasks'
set :rails_env, 'production'
set :domain, 'YOUR_IP_OR_DOMAIN'
set :deploy_to, "/home/rails/#{rails_env}"
set :repository, 'git@github.com:fousa/<YOUR_REPOSITORY>.git'
@fousa
fousa / content.m
Created July 25, 2012 22:11
Obj-C Save Block
typedef void(^MyBlock)(void);
MyBlock savedBlock = ^ {
// Executed block
};
@fousa
fousa / content.m
Created July 23, 2012 21:24
NSNumber to NSData
NSUInteger index = 999;
NSData *payload = [NSData dataWithBytes:&index length:sizeof(index)];
@fousa
fousa / content.m
Created July 23, 2012 18:17
Localize NSError
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
[userInfo setObject:@"You are not authenticated." forKey:NSLocalizedDescriptionKey];
NSError *error = [NSError errorWithDomain:@"mydomain" code:0 userInfo:userInfo];