Skip to content

Instantly share code, notes, and snippets.


Tamim Bin Ibrahim tamimibrahim

View GitHub Profile
tamimibrahim / file1.txt
Created Nov 18, 2017
Test gist using api
View file1.txt
Cool gist , working or not ?
tamimibrahim / file1.txt
Created Nov 18, 2017
Test gist using api
View file1.txt
Cool gist , working or not ?
tamimibrahim /
Created Oct 18, 2015 — forked from scottjehl/
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:

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: ).

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

View screenshots.js
* 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
var casper = require("casper").create();
View gist:dc5d70d06cc6cc1714d5
var page = require('webpage').create();
page.settings.loadImages = false;
page.onConsoleMessage = function(msg) { console.log(msg); };
var pageUrl = '';
var num = 0;
var max = 2;
page.onLoadFinished = function() {
var text = page.evaluate(function() {
View fake-referrer.phantom.js
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');
// Set the important pieces
View t5-silent-flush.php
<?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 <>
* Author URI:
* License: MIT
* License URI:
View SmoothScroll.js
// SmoothScroll for websites v1.2.1
// Licensed under the terms of the MIT license.
// People involved
// - Balazs Galambosi (maintainer)
// - Michael Herf (Pulse Algorithm)
// Scroll Variables (tweakable)
View color-gen.html
<script src="" type="text/javascript"></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);