A Pen by Abhisek Jana on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cool gist , working or not ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cool gist , working or not ? |
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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes. | |
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed | |
* | |
* Usage: | |
* $ casperjs screenshots.js http://example.com | |
*/ | |
var casper = require("casper").create(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(); | |
page.settings.loadImages = false; | |
page.onConsoleMessage = function(msg) { console.log(msg); }; | |
var pageUrl = 'http://www.bloggersentral.com/2010/08/how-put-add-adsense-on-blogger.html'; | |
var num = 0; | |
var max = 2; | |
page.onLoadFinished = function() { | |
var text = page.evaluate(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var system = require('system'); | |
// Exit in case of wrong parameter count. | |
if (system.args.length !== 3) { | |
console.log('Usage: scriptname targetUrl referrer'); | |
console.log('example: $> phantomjs fake-referrer.phantom.js http://example.com http://referrer.example.com'); | |
phantom.exit(); | |
} | |
// Set the important pieces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php # -*- coding: utf-8 -*- | |
/** | |
* Plugin Name: T5 Silent Flush | |
* Description: Flushes rewrite rules whenever a custom post type or taxonomy is registered and not already part of these rules. This is a soft flush, the .htaccess will not be rewritten. | |
* Version: 2013.05.04 | |
* Author: Thomas Scholz <[email protected]> | |
* Author URI: http://toscho.de | |
* License: MIT | |
* License URI: http://www.opensource.org/licenses/mit-license.php | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SmoothScroll for websites v1.2.1 | |
// Licensed under the terms of the MIT license. | |
// People involved | |
// - Balazs Galambosi (maintainer) | |
// - Michael Herf (Pulse Algorithm) | |
(function(){ | |
// Scroll Variables (tweakable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> | |
<script> | |
$(document).ready(function() { | |
var colortest = $("#colortest"); | |
for (i = 1; i <= 300; i++) { | |
var c = genColor(); | |
var newhtml = "<span style='font-family:\"Courier\",monospace;width:50px;height:30px;background-color:#" + c + "'>#" + c + "</span>"; | |
colortest.html(colortest.html() + newhtml); |
NewerOlder