Skip to content

Instantly share code, notes, and snippets.

View danomanion's full-sized avatar

LaminarRainbow danomanion

View GitHub Profile
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@aaronott
aaronott / gist:3278232
Created August 6, 2012 20:40
Make a user login prior to accessing anything on the site.
global $user;
/*
* If the user is not logged in, require them to login prior to being
* redirected to the form
*/
if ($user->uid === 0 && arg(0) != 'user') {
$dest = drupal_get_path_alias($_GET['q']);
drupal_goto('user', array('query' => array('destination' => $dest)));
}
@aaronott
aaronott / d7_fixperms.sh
Created October 17, 2012 20:37
Fix D7 file permissions
#!/bin/sh
PERM_USER=nobody
PERM_GROUP=dev
APACHE_USER=apache
if [ $# -ne 1 ] ; then
echo "USAGE $0 <d7 root dir>"
exit;
fi
@kenwoodworth
kenwoodworth / Design Smarter, Not Harder - Resources & Links.md
Last active December 18, 2015 21:09
A collection of links from my talk, Design Smarter, Not Harder
~/.ideas.md
# Software
- doomed startup idea 1
- some feature for an open-source project
- doomed startup idea 2
- ...
# Blog posts
- the .ideas file
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active April 2, 2024 02:45
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@scottjehl
scottjehl / noncritcss.md
Last active August 12, 2023 16:57
Comparing two ways to load non-critical CSS

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

@omnibs
omnibs / phoenix showdown rackspace onmetal io.md
Last active January 25, 2023 18:33
Phoenix Showdown Comparative Benchmarks @ Rackspace

Comparative Benchmark Numbers @ Rackspace

I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.

Results

Framework Throughput (req/s) Latency (ms) Consistency (σ ms)
@mparker17
mparker17 / 7-docker-compose.yml
Last active May 8, 2017 14:08
Docker-compose templates for D7, D8
#
# Minimal Drupal 7.x development environment.
#
# Use:
# 1. Place a copy of this file at your Drupal site root.
# 2. Start the web stack: `USER_ID=$(id -u) docker-compose up -d`
# 3. Set up `settings.local.php` (note that the host is 'db' and the username,
# password, and schema are in the environment variables for the database
# container below).
# 4. If you have a database dump to import, place it in your Drupal site root,
#!/bin/sh
SOURCEDIR=/path/to/docroot
DESTDIR=/path/to/backup/dir
NAME=<site-name>
RETENTION=2
let MMIN=($RETENTION*60*24)-180
DATE=`date +%Y-%m-%d-%H-%M`
EXCLUDE=""