Skip to content

Instantly share code, notes, and snippets.

View vortizhe's full-sized avatar

Victor Ortiz vortizhe

View GitHub Profile
/**
* URL like:
* https://unsplash.com/?page=44
*/
var
base_url = 'https://unsplash.com',
result = [],
last_page = 1;
@carloscabo
carloscabo / js_module_closure.js
Last active March 17, 2016 15:34
JS Module with closure
;(function($, undefined) {
'use strict';
if (typeof window.MY_MODULE_NAME !== 'undefined') {
return;
}
//
// Module general vars
//
@jamescmartinez
jamescmartinez / slack_delete.rb
Last active May 28, 2024 15:00
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
@afgomez
afgomez / iterm_profile.sh
Created June 25, 2013 09:24
function to change iTerm2 color profile from the terminal
#!/bin/bash
# Change the iterm2 profile programatically
function iterm_profile {
if [[ -z $1 ]]; then
profile="Default"
else
profile=$1
fi
@afgomez
afgomez / validate_spanish_id.js
Last active May 5, 2024 12:31
Spanish DNI, CIF, NIE validator
/**
* ValidateSpanishID. Returns the type of document and checks its validity.
*
* Usage:
* ValidateSpanishID( str );
*
* > ValidateSpanishID( '12345678Z' );
* // { type: 'dni', valid: true }
*
* > ValidateSpanishID( 'B83375575' );
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@brenes
brenes / gist:3293652
Created August 8, 2012 09:07
jquery validation for selects and uniform
$('form').validate({
errorPlacement: function(error, element) {
if (element[0].tagName == "SELECT") {
element.parent().addClass('error');
}
return true;
},
unhighlight: function(element, errorClass, validClass) {
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@tjh
tjh / character_set_and_collation.rb
Created January 31, 2012 16:07
Convert all Rails table column collation and character set
#!/usr/bin/env ruby
# Put this file in the root of your Rails project,
# then run it to output the SQL needed to change all
# your tables and columns to the same character set
# and collation.
#
# > ruby character_set_and_collation.rb
DATABASE = ''