Skip to content

Instantly share code, notes, and snippets.

@richardtape
richardtape / install-oh-my-zsh-on-ubuntu
Created August 4, 2014 01:58
Install Oh My ZSH on Ubuntu 14.04
# 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
@Yimiprod
Yimiprod / difference.js
Last active May 10, 2024 16:49
Deep diff between two object, using lodash
/**
* 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) {
@stefanvangastel
stefanvangastel / default.ctp
Last active October 10, 2017 15:11 — forked from ichord/gist:9808444
demo of using pdf.js to extract pages to images in CakePHP (http://book.cakephp.org/3.0/en/views.html#using-view-blocks)
//Your layout file
<html>
<head>
//etc
</head>
<body>
//Bla bla
<?php
@dserodio
dserodio / delete-all-slack-images.py
Last active March 28, 2018 20:35
Delete all images in Slack that were uploaded until yesterday
#!/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'
@KentarouKanno
KentarouKanno / KeyboardToolBar.md
Last active May 9, 2022 05:25
KeyboardToolBar

KeyBoardToolBar

Github Sample

import UIKit

class ViewController: UIViewController, UITextFieldDelegate {

    @IBOutlet weak var textField: UITextField!
@ahtcx
ahtcx / deep-merge.js
Last active June 9, 2024 14:56
Deep-Merge JavaScript objects with ES6
// ⚠ 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]))
}
@HarishChaudhari
HarishChaudhari / passwordRegex.js
Created August 1, 2016 13:29
Password validation RegEx for JavaScript
/**
* 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 => !@#$%^&*
*
@doluvor
doluvor / Thumbnail.m
Created October 18, 2016 03:34
Generate thumbnail of video
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);
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"