Skip to content

Instantly share code, notes, and snippets.

View rictorres's full-sized avatar
💅
startuppin'

Ricardo Torres rictorres

💅
startuppin'
View GitHub Profile
# ~/.osx — http://mths.be/osx
# root check
if [[ $EUID -ne 0 ]]; then
echo "################################";
echo "## YOU ARE NOT RUNNING AS ROOT #";
echo "################################";
echo "#";
echo "# USAGE: sudo $0";
exit;
@rictorres
rictorres / import.php
Created May 31, 2013 05:48
import emails from wp comments
<?php
$db = new mysqli('host', 'user', 'pass', 'bd');
$sql = "SELECT comment_author_email, comment_author
FROM `wp_comments`
WHERE comment_author_email <> ''
GROUP BY comment_author_email
ORDER BY (
comment_author_email
@rictorres
rictorres / rwd-bookmarklet.js
Created June 8, 2013 09:01
I don't remember where I found this :(
javascript:void((function()%7Bvar d%3Ddocument%3Bd.write(%27<!DOCTYPE html><html><head><meta charset%3D"UTF-8"><title>%27%2Bd.title%2B%27 - Responsive test</title><link rel%3D"stylesheet" href%3D"http://responsive.victorcoulon.fr/assets/css/app.css"><script src%3D"http://responsive.victorcoulon.fr/assets/js/app.min.js"></script></head><body><header><div class%3D"close"><a href%3D"%23">×</a></div><div id%3D"size"></div><div class%3D"keyboard"><a href%3D"%23">I</a></div><div class%3D"cssrefresh"><a href%3D"%23">I</a></div><div id%3D"devices"><a href%3D"%23" class%3D"tablet-portrait"><span>Tablet Portrait</span></a><a href%3D"%23" class%3D"tablet-landscape"><span>Tablet Landscape</span></a><a href%3D"%23" class%3D"smartphone-landscape"><span>iPhone Landscape</span></a><a href%3D"%23" class%3D"smartphone-portrait"><span>iPhone Portrait</span></a><a href%3D"%23" class%3D"auto active"><span>Auto</span></a></div></header><section><div id%3D"wrapper"><iframe src%3D"%27%2Bd.URL%2B%27" onLoad%3D"resbook.changeUrl(this.
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* STYLES GO HERE */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
@rictorres
rictorres / detect.js
Created July 18, 2013 00:46
detect user bandwidth!
var imageAddr = "http://www.tranquilmusic.ca/images/cats/Cat2.JPG" + "?n=" + Math.random();
var startTime, endTime;
var downloadSize = 5616998;
var download = new Image();
download.onload = function () {
endTime = (new Date()).getTime();
showResults();
}
startTime = (new Date()).getTime();
download.src = imageAddr;
.declaration-order {
/* Positioning */
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 100;
<?php
class Cidades_estados_pais extends CI_Model {
public function index() {
//-----------------------------------------------
// Se preferir altere o nome da tabela e colunas
//
$tabela = 'sys_cidades_estados_pais';
@rictorres
rictorres / Gruntfile.js
Created July 31, 2013 20:31
very ugly, i know
'use strict';
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var projectConfig = {
dev: 'dev',
(function(document,navigator,standalone) {
// prevents links from apps from oppening in mobile safari
// this javascript must be the first script in your <head>
if ((standalone in navigator) && navigator[standalone]) {
var curnode, location=document.location, stop=/^(a|html)$/i;
document.addEventListener('click', function(e) {
curnode=e.target;
while (!(stop).test(curnode.nodeName)) {
curnode=curnode.parentNode;
}
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){