Skip to content

Instantly share code, notes, and snippets.

David Gasperoni mcdado

View GitHub Profile
@mcdado
mcdado / sphp.sh
Last active Oct 26, 2016 — forked from w00fz/sphp.sh
PHP switcher
View sphp.sh
#!/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
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@mcdado
mcdado / safari-many-inputs-sluggish-test-case.html
Created Apr 29, 2016
Test case for Safari: typing performance with huge amount of input fields on page
View safari-many-inputs-sluggish-test-case.html
<!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 Aug 29, 2015
wwdc-extract-titles.js
View 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 Aug 29, 2015
Extract WWDC videos' info to YAML with jQuery
View wwdc-extract-yaml.js
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 Apr 22, 2012 — forked from marcoarment/Bcrypt.php
PHP Bcrypt class
View Bcrypt.php
<?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.
You can’t perform that action at this time.