Skip to content

Instantly share code, notes, and snippets.

View mcdado's full-sized avatar
🏠
Working from home

David Gasperoni mcdado

🏠
Working from home
View GitHub Profile
@mcdado
mcdado / sphp.sh
Last active October 26, 2016 13:56 — forked from w00fz/sphp.sh
PHP switcher
#!/bin/bash
# Check if command was ran as root.
if [[ $(id -u) -eq 0 ]]; then
echo "The command \"sphp\" should not be executed as root or via sudo directly."
echo "When a service requires root access, you will be prompted for a password as needed."
exit 1
fi
# Usage

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@mcdado
mcdado / safari-many-inputs-sluggish-test-case.html
Created April 29, 2016 21:35
Test case for Safari: typing performance with huge amount of input fields on page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test case for huge amount of input fields on page</title>
<!-- Bootstrap: Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
@mcdado
mcdado / wwdc-extract-titles.js
Last active August 29, 2015 14:02
wwdc-extract-titles.js
var sessions = [];
jQuery("li.session").each(function () {
var current = jQuery(this),
session = {
'id' : current.attr("id").toString().replace('-video', ''),
'title' : current.find(".title").text(),
'description' : current.find(".description p:nth-child(2)").text(),
'track' : current.find(".track").text()
};
sessions.push(session);
@mcdado
mcdado / wwdc-extract-yaml.js
Last active August 29, 2015 14:01
Extract WWDC videos' info to YAML with jQuery
var sessions = [],
re = /\"/g;
jQuery("li.session").each(function () {
var current = jQuery(this),
session = {
'id' : current.attr("id").toString().replace('-video', ''),
'title' : current.find(".title").text(),
'description' : current.find(".description p:nth-child(2)").text(),
'track' : current.find(".track").text()
@mcdado
mcdado / Bcrypt.php
Created April 22, 2012 15:37
PHP Bcrypt class
<?php
/*
bcrypt class for PHP 5.3 and above.
An implentation by Marco Arment.
It uses Blowfish hashing.
Simplified by David Gasperoni <mcdado@gmail.com>.
Forked from Marco Arment <me@marco.org>.
This code is released in the public domain.