Skip to content

Instantly share code, notes, and snippets.

View scott-joe's full-sized avatar
🛠️
Tinkering

Scott Williams scott-joe

🛠️
Tinkering
View GitHub Profile
@interactivellama
interactivellama / embedded-media-queries.less
Last active August 29, 2015 14:07
Em-based embedded media queries with LESS
/* --------------------------------------------
EM-BASED EMBEDDED MEDIA QUERIES WITH LESS
---------------------------------------------*/
/* The following are defaults for media queries. Additional custom measurements
may be needed for certain elements, although non-content-based breakpoints
are quite convenient. These are proportional media queries using ems. Ems are a
browser-based font size, (example - 16px = 14pt = 1em ). For more information,
check out: http://blog.cloudfour.com/the-ems-have-it-proportional-media-queries-ftw/
P = Portrait orientation, L = Landscape orientation
@iowillhoit
iowillhoit / uppercaseToCss
Created August 8, 2013 17:39
Changes uppercase sequences to lowercase and wraps in a span with the "text-transform:uppercase" style. This is helpful to lower your spam rating on email newsletters. Most spam filters don't like seeing ALL CAPS, because it's usually IS spam..
<?php
function replaceUpperCaseWithCss($matches){
$lower = strtolower($matches[0]);
return sprintf('<span style="text-transform:uppercase;">%s</span>', $lower);
}
function findUpperCaseSequences($text){
return preg_replace_callback("/[^a-z\ ]{2,}(\ [^a-z\ ]+)*\b/", "replaceUpperCaseWithCss", $text);
}
@interactivellama
interactivellama / node-util.sublime-snippet
Created March 15, 2016 20:58
Snippet for NodeJS's util library that inspects all levels of a variable
<snippet>
<!-- Snippet for https://nodejs.org/api/util.html -->
<!-- Put this file in `Sublime Text 3/packages/User/ then restart. -->
<!-- Don't forget to import `const util = require('util');` -->
<content><![CDATA[console.log(util.inspect($1,false, null));$0]]></content>
<tabTrigger>util</tabTrigger>
<scope>text.html,source.js</scope>
<description>console.log(util.inspect())</description>
</snippet>
@omorandi
omorandi / app.js
Created December 19, 2010 10:41
Appcelerator Titanium Mobile - Custom events
var win1 = Titanium.UI.createWindow({
title:'Window 1',
backgroundColor:'#fff'
});
var label1 = Titanium.UI.createLabel({
color:'#999',
text:'Window 1\nClick anywhere for opening Window 2',
textAlign:'center',
#!/usr/bin/env bash
# Configurable variables
database='vagrant'
username='vagrant'
password='vagrant'
echo ''
echo ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
echo ' Bootstrapping Ubuntu Precise 32bit for Laravel 4'
@FiloSottile
FiloSottile / glyphicons-halflings
Created September 26, 2012 15:06
Glyphicons data URLs
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdUAAACfCAQAAAAFBIvCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAMaFJREFUeNrtfW1sXEW6pleytF7JurZEJHxuHHcn/qA7dn/Rjsc4jW0w+ZhrPGbZONmAsw4TPMtoMySIDCASCAxiLG1u5KDMDaMg0pMRF7jXEr6rMPHeH0wgWWA2cycdPgYUrFECAby/rh237p/9U/u+p7r6nG6fU/VWpzsxS71Hidv2c+rUqfM+VW+9x/VUVZUxY8aWnVl11rzF7GPe+WEm96PCI0MscNiaxBIUuD5r2roMF5+2+pZVg0xXCg8tc8ZuxzNWnXG8635Omv6j72/WGPxj6Mf4Sbt+TMUAGxWje//gLQnG+vFIOCVf6O+dTbLCo3f2Qr/isjZFV7LVLMSicIa8GYKsncVZAv4PMiutKFmz67AC8ECg77Em4fNBuy+atgKkBo61M2tY44Fo4BvfjdgtGWGN76ofs9dBwAfU6Dw+UPiVjCdcwaObSss7KPh9hiMAm1F6hJb/lICHOjTD/SVtP25mom50SyoYwK+y5mzLOUrJ2NoroUTe7kmn/Vl1MVmRqKxaXpygKB5dWVlFrb5mQOydwB7i0J6ubFjh7npdh1XXdKUdEAmoj3W5Db4m4QE1LVCapO1XgH2D/kB08JF83SNM9ZhZf5I9+7Rz8J/I3IIfrMb5LHcjByu+UvGUKxQ/kcaLYdZ40f8JWOkw+A4iEBtlYSmddP1HFw/dKtShd1YQrncW61ZeqsIAcmYleEIEKAhx1ry8ND6aFh/8V9VHtiPdBPGObFcRVTzQgcz40RO7WEpW0ba3k2z3i6zBvlL9xO4ka/1EVnLTSa+uo+mkNzrwWDyPcz4lWOAxAp2+TrKORXoPGvm6d5aKpzt50u4573rAOfhP1CUXfpbjl36l4XWpysmXBCr6PbGqqsTnSRvReJFj4Xl9rvYfHFko/qPrb9
@ecarter
ecarter / mapOrder.js
Created December 2, 2011 15:40
Order an array of objects based on another array order
/**
* Sort array of objects based on another array
*/
function mapOrder (array, order, key) {
array.sort( function (a, b) {
var A = a[key], B = b[key];
@Integralist
Integralist / GitHub curl.sh
Last active September 7, 2023 03:53 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@adbutterfield
adbutterfield / prettier.config.js
Last active February 21, 2024 05:17
Default prettier config with comments and links to prettier rules
module.exports = {
/**
* Print Width
* https://prettier.io/docs/en/options.html#print-width
*
* Specify the line length that the printer will wrap on.
*
* printWidth: <int>
* default: 80
*/
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',