Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
bradtraversy / npmcrashcourse.txt
Last active April 13, 2024 04:54
NPM Crash Course Commands
# GET VERSION
npm -v (or --version)
# GET HELP
npm help
npm
# CREATE PACKAGE.JSON
npm init
npm init -y (or --yes)
@squarism
squarism / iterm2.md
Last active May 6, 2024 22:59
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
<html>
<head>
<title>Basic Html Tags</title>
</head>
<body>
<img src ="Path of the file">//imagefile
<b>Hello</b>//bold
<i>hai</i>//italic
<u>Wonderful</u>//underlined
</body>
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
@andreareginato
andreareginato / oauth-blue-button.css
Last active August 29, 2015 14:01
Blue Button CSS for AngualrJS OAuth directive
.oauth span {
text-decoration: none;
background: #239cbb;
box-sizing: border-box;
min-height: 35px;
width: auto;
display: inline-block;
padding: 0.9em 1.37em;
cursor: pointer;
color: #fff !important;
@rizalp
rizalp / JavaScript Sieve Of Atkin.js
Created May 3, 2013 11:49
return array of primes below limit using Sieve of Atkin Algorithm http://en.wikipedia.org/wiki/Sieve_of_Atkin #JavaScript #primes
function sieveOfAtkin(limit){
var limitSqrt = Math.sqrt(limit);
var sieve = [];
var n;
//prime start from 2, and 3
sieve[2] = true;
sieve[3] = true;
for (var x = 1; x <= limitSqrt; x++) {
@jrhames
jrhames / moment-holidays.js
Last active January 19, 2023 03:12
Holidays plugin for Moment.JS
//## Moment.JS Holiday Plugin
//
//Usage:
// Call .holiday() from any moment object. If date is a US Federal Holiday, name of the holiday will be returned.
// Otherwise, return nothing.
//
// Example:
// `moment('12/25/2013').holiday()` will return "Christmas Day"
//
//Holidays:
@aarongustafson
aarongustafson / watchResize.js
Last active September 16, 2019 14:37
Efficient callback management for window.onresize
(function( window ){
window.watchResize = function( callback ){
var resizing;
callback.size = 0;
function done()
{
var curr_size = window.innerWidth;
clearTimeout( resizing );
resizing = null;
// only run on a true resize