Skip to content

Instantly share code, notes, and snippets.

View paulmsmith's full-sized avatar

Paul Smith paulmsmith

View GitHub Profile
@necolas
necolas / snippet.js
Created June 14, 2011 20:36
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
@paulmsmith
paulmsmith / nas_commands.txt
Created January 25, 2014 00:52
useful NAS unix commands
#recursively extract rars from subdirectoes to current dir
/opt/bin/find -name '*.rar' -exec unrar e '{}' ';'
#replace space with a dot in file names (and folders)
ls -1 | while read a; do mv "$a" `echo $a | sed -e 's/\ /\./g'`; done
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
.module {
some: stuff;
&__child {
blah: blah;
}
&--modifier {
modify: me;
}
}
@framp
framp / common-dustjs-helpers.js
Created June 13, 2014 18:43
Fixed some issues with the module common-dustjs-helpers
(function (dust) {
var _eval_dust_string = function(str, chunk, context) {
var buf;
if (typeof str === "function") {
if (str.length === 0) {
str = str();
} else {
buf = '';
(chunk.tap(function(data) {
buf += data;
@pburtchaell
pburtchaell / styles.css
Last active February 25, 2024 12:24
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active January 16, 2024 01:17
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {
@oroce
oroce / app.js
Last active June 16, 2021 21:05
Redirect express while keeping params
/*
URLs:
http://localhost:3000/arrive?foo=bar&utm_source=smart-redir
*/
var redirect = require('redirect-with-params');
var express = require('express');
var app = express();
app.use(redirect({
@tedmiston
tedmiston / archive-all-facebook-messages.js
Last active April 8, 2024 07:36
Archive all of the messages in your Facebook Messages Inbox
function archive_all(testOnly) {
var someMessages, archiveButton;
if (testOnly === "undefined") { testOnly = false; }
someMessages = $("li._k- span.accessible_elem");
console.log("Found", someMessages.length, "messages to archive in your inbox.");
archiveButton = null;
someMessages.each(function () {
@s10wen
s10wen / gist:73afbfa5971ba966307a
Last active August 24, 2016 08:25
UpFrontConf 2015 - Slides
Brad Frost:
TBC
Alicia Sedlock:
https://speakerdeck.com/aliciasedlock/jumping-into-front-end-testing
Richard Rutter:
http://webtypography.net/talks/upfront2015/
Soledad Penadés: