most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat
<?php | |
/* | |
*I dont know if this can be useful for you but | |
* | |
*I came up with it, and I give it as a present to you. | |
* | |
*I'm not a skillful programmer, I just enjoy doing this, | |
* | |
*Thanks for reading | |
********************************************************* |
My list of commonly used sites for web development
Tool | Address |
---|---|
Create Data URLs | http://dataurl.net/#about |
Desktop Browser Compatibility Tables For DOM Events | http://www.webbrowsercompatibility.com |
Can I Use | http://caniuse.com/ |
PHP Composer repository | https://packagist.org |
// returns true is browser is mobile | |
// added "|android|ipad|playbook|silk" to first regex to detect tablets | |
// This leaves 2 'android' tests in the first regex. One of the 'android' tests can be eliminated | |
// but left in so you can remove the "|android|ipad|playbook|silk" string easily. | |
function isMobile() { | |
var a = navigator.userAgent||navigator.vendor||window.opera; | |
if (/(android|bb\d+|meego|android|ipad|playbook|silk).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng) |
// credit Rolf Timmermans | |
// http://voormedia.com/blog/2012/11/responsive-background-images-with-fixed-or-fluid-aspect-ratios | |
/* Calculate fluid ratio based on two dimensions (width/height) */ | |
@mixin fluid-ratio($large-size, $small-size) { | |
$width-large: nth($large-size, 1); | |
$width-small: nth($small-size, 1); | |
$height-large: nth($large-size, 2); | |
$height-small: nth($small-size, 2); | |
$slope: ($height-large - $height-small) / ($width-large - $width-small); |
#!/bin/bash | |
set -o errexit | |
git filter-branch --tree-filter "git rm -r -f --ignore-unmatch *.psd" HEAD | |
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune |
// Marker, a bookmarklet for Markdownifying webpage selections | |
// javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading…</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://gist.github.com/ttscoff/8078727/raw/Marker.js?x="+(Math.random());})(); | |
(function () { | |
function callback() { | |
(function ($) { | |
var raw, userSelection; | |
if (window.getSelection) { | |
// W3C Ranges | |
userSelection = window.getSelection (); | |
// Get the range: |
<?php | |
if ( isset( $_GET['test'] ) && 'shawn' == $_GET['test'] ) : | |
add_action('init', 'make_user'); | |
endif; | |
function make_user() { | |
global $wpdb; | |
$wpdb->show_errors(); |
function _make_token( $length = 16 ) | |
{ | |
$token = ""; | |
$codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
$codeAlphabet.= "abcdefghijklmnopqrstuvwxyz"; | |
$codeAlphabet.= "0123456789"; | |
$max = strlen($codeAlphabet); // edited | |
for ($i=0; $i < $length; $i++) { | |
token .= $codeAlphabet[random_int(0, $max-1)]; | |
} |
<?php | |
/** | |
* Array of Countries with ISO value as keys | |
* @var array | |
*/ | |
$countries = array( 'AF' => 'Afghanistan', 'AX' => 'Åland Islands', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AS' => 'American Samoa', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarctica', 'AG' => 'Antigua and Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', 'AW' => 'Aruba', 'AU' => 'Australia', 'AT' => 'Austria', 'AZ' => 'Azerbaijan', 'BS' => 'Bahamas', 'BH' => 'Bahrain', 'BD' => 'Bangladesh', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgium', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivia', 'BA' => 'Bosnia and Herzegovina', 'BW' => 'Botswana', 'BV' => 'Bouvet Island', 'BR' => 'Brazil', 'IO' => 'British Indian Ocean Territory', 'BN' => 'Brunei Darussalam', 'BG' => 'Bulgaria', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', 'CA' => 'Canada', 'CV' => 'Cape Verde', 'KY' => 'Cayman Islands', 'CF' => 'Central African Republic', 'TD' = |