Skip to content

Instantly share code, notes, and snippets.

View jubstuff's full-sized avatar

Giustino Borzacchiello jubstuff

View GitHub Profile
@jubstuff
jubstuff / FilterStorage.php
Last active August 29, 2015 14:19
Filter Storage
<?php
/**
* Stores a value and calls any existing function with this value.
*/
class FilterStorage
{
/**
* Filled by __construct(). Used by __call().
*
* @type mixed Any type you need.
@jubstuff
jubstuff / autofill.php
Created April 11, 2015 18:22
Wrap text in imagick
<?php
/**
* Auto Fit Text To Image
*
* Write text to image using a target width, height, and starting font size.
*
* @author Clif Griffin
* @url http://cgd.io/2014/auto-fit-text-to-an-image-with-php-and-wordpress
*
@jubstuff
jubstuff / gist:e39e1446b13be872edf2
Created February 25, 2015 15:47
Skip confirmation on git clone from Bitbucket
echo -e "Host bitbucket.org\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
@jubstuff
jubstuff / print
Created February 24, 2015 14:47
Print a page in an hidden iframe
<script type="text/javascript">
function closePrint () {
document.body.removeChild(this.__container__);
}
function setPrint () {
this.contentWindow.__container__ = this;
this.contentWindow.onbeforeunload = closePrint;
this.contentWindow.onafterprint = closePrint;
this.contentWindow.focus(); // Required for IE
@jubstuff
jubstuff / createuser
Created December 22, 2014 18:54
Create user in Mysql
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
@jubstuff
jubstuff / .htaccess
Last active August 29, 2015 14:08
wp-cli.yaml for single wordpress install
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
@jubstuff
jubstuff / gist:a5aa601d95b4f295d440
Created October 13, 2014 14:25
List all commit messages from a tag to HEAD
git log --oneline $(git rev-list $TAG | head -n 1)..HEAD | sed '/Merge remote-tracking/d'
@jubstuff
jubstuff / 0_reuse_code.js
Created April 1, 2014 08:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jubstuff
jubstuff / getTheRemainingArguments.js
Last active January 4, 2016 11:49
How to get all the arguments of a function but the first
function test() {
var otherArgs = Array.prototype.slice.call(arguments, 1);
console.log(otherArgs);
}
console.log('test()');
test();
console.log('test(1)');
test(1);
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<style>
#box {
background-color: #369;
height: 100px;