Skip to content

Instantly share code, notes, and snippets.

View willwfsp's full-sized avatar

Will Policiano willwfsp

View GitHub Profile
@willwfsp
willwfsp / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@willwfsp
willwfsp / password_reset.txt
Last active January 16, 2016 16:18
Recuperar senha do mac
fsck -fy
mount -uw /
rm /var/db/.AppleSetupDone
shutdown -h now
@willwfsp
willwfsp / ios_url_schemes.md
Last active February 18, 2023 02:59
iOS URL Schemes

I've recently discovered the awesome iOS5 custom Settings URL Scheme, which can be explained in detail at this great [website].

I've found this to work, directing the user to the Settings app from my application:

[[UIApplication sharedApplication] openURL:
       [NSURL URLWithString:@"prefs:root=General"]];
@willwfsp
willwfsp / models_1-kinds.swift
Last active April 12, 2020 22:04
Kinds of models
// Entity Model
struct User {
let name: String
let email: String
let nickName: String
}
// Event
struct ViewScreen {
let sessionId: String
@willwfsp
willwfsp / models_2-overloaded.swift
Last active April 12, 2020 22:31
Overloaded Model
import Foundation
class User: Codable {
var login: String?
var id: Int?
var node_id: String?
var avatar_url: String?
var gravatar_id: String?
var url: String?
var html_url: String?
@willwfsp
willwfsp / Random.swift
Created August 19, 2020 13:55
Utility to generate random values
import Foundation
public protocol Random {
static var anyValue: Self { get }
}
extension Optional: Random where Wrapped: Random{
public static var anyValue: Optional<Wrapped> {
let optional = Optional<Wrapped>(.anyValue)
return Bool.random() ? optional : nil
@willwfsp
willwfsp / prepare-commit-msg
Last active January 19, 2024 20:31
Add Jira ticket to commit
#!/bin/bash
#
# Automatically adds branch name and branch description to every commit message.
# Modified from the gist here https://gist.github.com/bartoszmajsak/1396344
#
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
declare -a BRANCHES_TO_SKIP=(master staging develop)
@willwfsp
willwfsp / pre-commit
Last active January 19, 2024 20:30
Lint on pre-commit
#!/bin/sh
# Note:
# 1. Make sure you have SwiftLint installed and available in your system's PATH.
# Important:
# Remember to customize the script to suit your specific project needs, such as providing the correct
# paths to 'swiftlint'.
# Execute SwiftLint with --fix to automatically fix some of the linting issues.