Skip to content

Instantly share code, notes, and snippets.

View revelt's full-sized avatar
🤗
hello

Roy Revelt revelt

🤗
hello
View GitHub Profile
@seantunwin
seantunwin / lazy-load-files.js
Last active June 10, 2021 06:07
Lazy load JavaScript files
/* This is a technique to lazy load your javascript files
* Handy for those pesky slow, load blocking off-site scripts
* function lazyLoad
* @s: String of path to file
*/
function lazyLoad(s) {
var d = window.document,
b = d.body, /* appends at end of body, but you could use other methods to put where you want */
e = d.createElement("script");
@bag-man
bag-man / cpu.js
Last active March 29, 2024 12:01
How to calculate the current CPU load with Node.js; without using any external modules or OS specific calls.
var os = require("os");
//Create function to get CPU information
function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores
@adamstac
adamstac / _font-smoothing.scss
Created February 27, 2013 15:46
WebKit font-smoothing Sass mixin
// WebKit font-smoothing
//------------------------------------------------
// References:
//
// 1. http://maxvoltar.com/sandbox/fontsmoothing/
// 2. http://maxvoltar.com/archive/-webkit-font-smoothing
//
// Values: none, antialiased (default), subpixel-antialiased
//
@kylerush
kylerush / s3-maxcdn-deploy.py
Created January 22, 2013 18:09
Git, S3 and MaxCDN Python deploy script. The script gets the changed file between the two latest Git commits, uploads the changed files to S3 and then purges the paths from MaxCDN using the API.
#!/usr/bin/env python
#install the follow first:
#sudo easy_install pip
#sudo pip install -U boto
#sudo pip install configparser
@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>
@faisalman
faisalman / baseConverter.js
Last active January 11, 2023 14:43
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@nicerobot
nicerobot / README.md
Last active February 25, 2024 02:41
Mac OS X uninstall script for packaged install of node.js from https://stackoverflow.com/a/9287292/23056

To run this, you can try:

curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh
chmod +x ./uninstall-node.sh
./uninstall-node.sh
rm uninstall-node.sh
@dsimard
dsimard / singletons in javascript.js
Created October 19, 2010 15:50
Real javascript singleton
var myApplication = {};
myApplication.instance = (function() {
var i = {
msg : "Hello world!",
hello : function() {
alert(i.msg);
}
};