Skip to content

Instantly share code, notes, and snippets.

View revelt's full-sized avatar
🤗
hello

Roy Revelt revelt

🤗
hello
View GitHub Profile
@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);
}
};
@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
@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

@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(){
@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>
@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
@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
//
@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
@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");
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.