I've moved this gist to https://github.com/phynet/iOS-Schemes please check it there ;)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Where is the location of your current shall. Useful if we need to revert | |
echo $0 | |
# Install ZSH | |
sudo apt-get install zsh | |
# Instal GIT | |
sudo apt-get install git-core | |
# Install OhMyZSH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This code is licensed under the terms of the MIT license | |
* | |
* Deep diff between two object, using lodash | |
* @param {Object} object Object compared | |
* @param {Object} base Object to compare with | |
* @return {Object} Return a new object who represent the diff | |
*/ | |
function difference(object, base) { | |
function changes(object, base) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Your layout file | |
<html> | |
<head> | |
//etc | |
</head> | |
<body> | |
//Bla bla | |
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Delete all images in Slack that were uploaded until yesterday""" | |
import requests | |
import datetime | |
import sys | |
TOKEN = 'Put your Slack auth token here' | |
SLACK_API = 'https://slack.com/api' |
import UIKit
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var textField: UITextField!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ⚠ IMPORTANT: this is old and doesn't work for many different edge cases but I'll keep it as-is for any of you want it | |
// ⚠ IMPORTANT: you can find more robust versions in the comments or use a library implementation such as lodash's `merge` | |
// Merge a `source` object to a `target` recursively | |
const merge = (target, source) => { | |
// Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties | |
for (const key of Object.keys(source)) { | |
if (source[key] instanceof Object) Object.assign(source[key], merge(target[key], source[key])) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Password validation RegEx for JavaScript | |
* | |
* Passwords must be | |
* - At least 8 characters long, max length anything | |
* - Include at least 1 lowercase letter | |
* - 1 capital letter | |
* - 1 number | |
* - 1 special character => !@#$%^&* | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AVAsset *asset = [AVAsset assetWithURL:url]; | |
CMTime duration = [asset duration]; | |
CMTime snapshot = CMTimeMake(duration.value * progress, duration.timescale); | |
AVAssetImageGenerator *generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:asset]; | |
CGImageRef imageRef = [generator copyCGImageAtTime:snapshot actualTime:nil error:nil]; | |
UIImage *thumbnail = [UIImage imageWithCGImage:imageRef]; | |
CGImageRelease(imageRef); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.factory('utils', function() { | |
return { | |
validCpf: function(cpf) { | |
if ( !cpf || cpf.length != 11 | |
|| cpf == "00000000000" | |
|| cpf == "11111111111" | |
|| cpf == "22222222222" | |
|| cpf == "33333333333" | |
|| cpf == "44444444444" | |
|| cpf == "55555555555" |