Skip to content

Instantly share code, notes, and snippets.

@inxilpro
inxilpro / http_build_query.php
Created September 23, 2014 15:34
http_build_query polyfill
<?php
if (!defined('PHP_QUERY_RFC1738')) {
define('PHP_QUERY_RFC1738', 1);
}
if (!defined('PHP_QUERY_RFC3986')) {
define('PHP_QUERY_RFC3986', 2);
}
@inxilpro
inxilpro / gist:76b4c751893752004fe8
Last active August 29, 2015 14:06
Links of note

Humans Need Not Apply

Great video that argues a lot of my points re: automation killing jobs. This is not a bad thing. But I do believe it is an inevitable thing. We need to be thinking about how to prepare for a world where most jobs are done by machines.

NPR: Unemployment and Disability

If you don't believe this is a real thing, listen to This American Life: Trends With Benefits (part of the link above). People are becoming not just unemployed, but unemployable. A lot of this

@inxilpro
inxilpro / fish_prompt.fish
Created October 6, 2014 17:06
~/.config/fish/functions/
## Function to show a segment
function prompt_segment -d "Function to show a segment"
# Get colors
set -l bg $argv[1]
set -l fg $argv[2]
# Set 'em
set_color -b $bg
set_color $fg
@inxilpro
inxilpro / export-grants.sh
Created November 25, 2014 20:53
Export all MySQL user permissions
read -s -p "Enter MySQL password for root: " root_password
root_password=$(printf '%q' $root_password)
grants_command='SELECT DISTINCT CONCAT("SHOW GRANTS FOR `", user, "`@`", host, "`;") AS "query" FROM `mysql`.`user`;'
grants=$(mysql -N -s --user=root --password=$root_password --execute="$grants_command")
mysql -N -s -r --user=root --password=$root_password --execute="$grants"
<!DOCTYPE html>
<html>
<head>
<title>#000000</title>
<link href="//fonts.googleapis.com/css?family=Oswald:400,700" rel="stylesheet" type="text/css" />
<style>
html, body {
height: 100%;
overflow: hidden;
}
@inxilpro
inxilpro / forever.sh
Created January 6, 2015 16:52
forever init.d script
#!/bin/bash
# chkconfig: 345 88 08
# description: Forever for Node.js
# ----------------------------------------------------------------------
# Configuration
# ----------------------------------------------------------------------
# Run node scripts as this user
RUN_AS=node
@inxilpro
inxilpro / 1-styles.less
Last active August 29, 2015 14:23
LESS preprocessor idea
/* Source LESS file */
.my-component {
background: #eee;
.subcomponent {
color: #000;
}
&.extreme {
@inxilpro
inxilpro / User.php
Created December 10, 2009 14:46
Sample code output from Galahad_Tool (see http://github.com/inxilpro/Galahad-FE/ for the rest of the code)
<?php
class Default_Form_User extends Zend_Form
{
public function init()
{
// Use the init() method to generate your form
$this->addElement('text', 'id', array(
'label' => 'Id',
<dl>
<dt><label for="username">Username:</label></dt>
<dd>
<input type="text" id="username" name="username" />
<label for="username" class="instructions">Please enter your username.</label>
</dd>
</dl>
<?php
$options = array(
'loginId' => 'Authorize.net Login ID',
'transactionKey' => 'Authorize.net Transaction Key',
'mode' => 'test'
);
$gateway = Galahad_Payment::factory('AuthorizeNet', $options);
$customer = new Galahad_Payment_Customer(array(
'firstName' => 'John',