Skip to content

Instantly share code, notes, and snippets.

View tjFogarty's full-sized avatar
🇮🇪

T.J. Fogarty tjFogarty

🇮🇪
View GitHub Profile
@salcode
salcode / .gitignore
Last active February 10, 2024 10:56
See https://salferrarello.com/wordpress-gitignore/ for the latest version of my WordPress .gitignore file
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
@hdragomir
hdragomir / sm-annotated.html
Last active March 5, 2024 08:57
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@jnankin
jnankin / gist:66829583bbcd9d16bb61
Last active June 19, 2020 01:16
casperJS unit test file for checking site for 404s and 500s
/**
* This casper unit test script checks for 404 internal links for a given root url.
*
* Adapted from: https://gist.github.com/n1k0/4509789
* Usage:
*
* $ casperjs test 404checker.js --includes=URI.js
*/
function equalizeHeight(watch, target) {
var maxHeight = -1;
$(watch).each(function () {
maxHeight = maxHeight > $(this).outerHeight() ? maxHeight : $(this).outerHeight();
});
$(target).each(function () {
$(this).outerHeight(maxHeight);
});
}
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@rap2hpoutre
rap2hpoutre / laravel-forge-deploy.sh
Last active March 28, 2024 15:45
Laravel Forge deploy script without downtime
# stop script on error signal
set -e
# remove old deployment folders
if [ -d "/home/forge/deploy" ]; then
rm -R /home/forge/deploy
fi
if [ -d "/home/forge/backup" ]; then
rm -R /home/forge/backup
fi
@therealklanni
therealklanni / using-git-guppy.md
Last active September 5, 2017 09:02
Supercharge your git hooks with gulp — Introducing git-guppy

Supercharge your git hooks with gulp

Introducing git-guppy

Automate your developer workflow with git-guppy. git-guppy allows you to add git-hooks to your project repository that are automatically installed when users clone and install your repository, so you won't have to worry about developers skipping essential workflow steps and bypassing your project guidelines.

Getting Started

So let's use a unit test scenario to illustrate an example. We're going to run unit tests before every commit (pre-commit hook) and reject the commit if the tests fail (giving the developer a chance to fix their tests before committing broken code).

@paulirish
paulirish / what-forces-layout.md
Last active May 6, 2024 07:54
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
@rssilva
rssilva / karma-conf.js
Created May 6, 2016 18:31
Writing tests using Jasmine with Browserify, Babel and generating coverage with Istanbul
const istanbul = require( 'browserify-istanbul' )
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['browserify', 'jasmine'],
files: [
// 'js/**/*.js',
'js/utils/**/*.js',
'test/spec/*.js'