Skip to content

Instantly share code, notes, and snippets.

View u01jmg3's full-sized avatar
🔷
Coding Hard

Jonathan Goode u01jmg3

🔷
Coding Hard
View GitHub Profile
@andreyvit
andreyvit / fpdi_with_annots.php
Created March 12, 2012 07:16
FPDI extension to preserve external hyperlinks
<?php
// FPDI extension that preserves hyperlinks when copying PDF pages.
//
// (c) 2012, Andrey Tarantsov <andrey@tarantsov.com>, provided under the MIT license.
//
// Published at: https://gist.github.com/2020422
//
// Note: the free version of FPDI requires unprotected PDFs conforming to spec version 1.4.
// I use qpdf (http://qpdf.sourceforge.net/) to preprocess PDFs before running through this
@guybedford
guybedford / jquery.ajaxqueue.js
Created April 23, 2012 12:12
jQuery AJAX queues
/*
Allows for ajax requests to be run synchronously in a queue
Usage::
var queue = new $.AjaxQueue();
queue.add({
url: 'url',
@jimmygle
jimmygle / PHP-Recursive-Implosion.php
Last active March 29, 2024 21:47
PHP function to recursively implode multi-dimensional arrays.
<?php
/**
* Recursively implodes an array with optional key inclusion
*
* Example of $include_keys output: key, value, key, value, key, value
*
* @access public
* @param array $array multi-dimensional array to recursively implode
* @param string $glue value that glues elements together
@cameronmcefee
cameronmcefee / gist:2641743
Created May 9, 2012 04:14
Font Configuration File
# Font Squirrel Font-face Generator Configuration File
# Upload this file to the generator to recreate the settings
# you used to create these fonts.
{"mode":"expert","formats":["ttf","woff","eot","svg"],"tt_instructor":"default","options_subset":"advanced","subset_custom":"","subset_custom_range":"f000-f073,f200-f273","filename_suffix":"-webfont","emsquare":"2048","spacing_adjustment":"0","rememberme":"Y"}
@jfarmer
jfarmer / 01-truthy-and-falsey-ruby.md
Last active April 16, 2024 03:40
True and False vs. "Truthy" and "Falsey" (or "Falsy") in Ruby, Python, and JavaScript

true and false vs. "truthy" and "falsey" (or "falsy") in Ruby, Python, and JavaScript

Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).

This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.

If you want to use or share this material, please see the license file, below.

Update

@nilium
nilium / key-bindings.json
Created August 11, 2012 23:14
A Sublime Text 2 plugin to enable running multiple commands in any given context from a single key binding.
[
{
"keys": ["ctrl+w"],
"command": "run_multiple",
"args": {
"commands": [
{"command": "find_under_expand", "args": null, "context": "window"},
{"command": "show_panel", "args": {"panel": "find"}, "context": "window"}
]
}
@adactio
adactio / placeholderFromDatalist.js
Created August 12, 2012 15:54
Generate a placeholder attribute from the datalist associated with that input.
(function(win,doc) {
if (doc.querySelectorAll) {
var inputs = doc.querySelectorAll('input[list]'),
total = inputs.length;
for (var i=0; i<total; i++) {
var input = inputs[i],
id = input.getAttribute('list'),
list = doc.getElementById(id),
options = list.getElementsByTagName('option'),
amount = options.length,
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@textarcana
textarcana / js_code_sniffs.md
Created August 17, 2012 03:37
Use PHP CodeSniffer for static analysis of JavaScript
@40
40 / revLine.txt
Created September 22, 2012 03:20
Reverse Line Order of Code in Notepad++
INSTRUCTIONS
Edit > Select All
TextFX > TextFX Tools > Insert Line Numbers
If TextFX > TextFX Tools > +Sort ascending is checked, uncheck it
TextFX > TextFX Tools > Sort lines case sensitive (at column)
TextFX > TextFX Tools > Delete Line Numbers or First Word