Skip to content

Instantly share code, notes, and snippets.

@WebReflection
WebReflection / String.prototype.template.js
Last active August 17, 2022 04:04
ES6 Template like strings in ES3 compatible syntax.
// this is now a module:
// https://github.com/WebReflection/backtick-template#es2015-backticks-for-es3-engines--
var template = require('backtick-template');
// just string
const info = 'template';
`some ${info}` === template('some ${info}', {info});

Stealing WiFi

/etc/hosts

This will let you access any google owned site. This includes: youtube, google cache, google translate, google search, gmail, google news, etc.

  • Install the HTTPS Everywhere extension
  • Add these rules to your /etc/hosts file
@staltz
staltz / introrx.md
Last active March 26, 2024 00:52
The introduction to Reactive Programming you've been missing
@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:

@jeffmo
jeffmo / gist:054df782c05639da2adb
Last active January 11, 2024 06:05
ES Class Property Declarations
@pascalpp
pascalpp / backbone.when.js
Last active August 29, 2015 13:57
Backbone.When
define(function(require) {
'use strict';
/* MODULE DEPENDENCIES */
var Backbone = require('backbone'),
_ = require('underscore');
/*
Backbone.When
2014-02-20 by pascal
@markgoodyear
markgoodyear / 01-gulpfile.js
Last active May 5, 2023 03:21
Comparison between gulp and Grunt. See http://markgoodyear.com/2014/01/getting-started-with-gulp/ for a write-up.
/*!
* gulp
* $ npm install gulp-ruby-sass gulp-autoprefixer gulp-cssnano gulp-jshint gulp-concat gulp-uglify gulp-imagemin gulp-notify gulp-rename gulp-livereload gulp-cache del --save-dev
*/
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
// if (!window.L) { window.L = function () { console.log(arguments);} } // optional EZ quick logging for debugging
/**
* A modified (improved?) version of the jQuery plugin design pattern
* See http://docs.jquery.com/Plugins/Authoring (near the bottom) for details.
*
* ADVANTAGES OF EITHER FRAMEWORK:
* - Encapsulates additional plugin action methods without polluting the jQuery.fn namespace
* - Ensures ability to use '$' even in compat modes
*
@wouterj
wouterj / post.md
Last active July 13, 2021 02:00
How to use Jekyll, Plugins and Sass on GitHub Pages

How to use Jekyll, Plugins and Sass on GitHub Pages

Jekyll is a great CMS for developers and GitHub Pages is a great host to store your Jekyll sites. There is just one problem, GitHub runs Jekyll in safe mode, which means you can't use plugins. One thing you can do is building the Jekyll website locally and then push to GitHub.

Alexandre Rademaker found a solution to do this easially, which is quite usefull: "GitHub Pages and Jekyll plugins" After reading this I thought, that can be done easier!

Aliases to rescue

Git provides a way to have aliases of bash commands. You can do this by adding items to the alias key of your configuration. For this, you can add this locally by adding this lines to your %PROJECT_ROOT%/.git/config file:

@murtaugh
murtaugh / 1. single-line.html
Last active April 21, 2021 16:23
Blockquote patterns for ALA
<figure class="quote">
<blockquote>It is the unofficial force—the Baker Street irregulars.</blockquote>
</figure>