Skip to content

Instantly share code, notes, and snippets.

View karn09's full-sized avatar

John Nieves karn09

View GitHub Profile
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@karn09
karn09 / index.html
Last active August 29, 2015 14:03
A Pen by John Nieves.
<div class="wheel">
<div class="centered"><img src="http://www.warrenphotographic.co.uk/photography/bigs/38733-Ginger-cat-white-background.jpg"></div>
<ul class="umbrella">
<li class="color"></li>
<li class="color"></li>
<li class="color"></li>
<li class="color"></li>
<li class="color"></li>
<li class="color"></li>
<li class="color"></li>
@karn09
karn09 / app.js
Created August 11, 2014 23:21
Quiz App
(function() {
var score = 0,
currentQuestion = 0,
questions = [{
question: "Who is the current president of the USA?",
choices: ['George Bush', 'Barack Obama', 'John F Kennedy', 'Bill Clinton'],
answer: 1
}, {
question: "Entomology is the science that studies?",
choices: ['Behavior', 'Insects', 'Rocks', 'Animals'],
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");

Developer Cheat Sheets

This are my cheat sheets that I have compiled over the years. Tired of searching Google for the same things, I started adding the information here. As time went on, this list has grown. I use this almost everyday and this Gist is the first bookmark on my list for quick and easy access.

I recommend that you compile your own list of cheat sheets as typing out the commands has been super helpful in allowing me to retain the information longer.

@karn09
karn09 / android
Last active August 29, 2015 14:27
Android!
Android created using CSS
-----
A [Pen](http://codepen.io/karn09/pen/JgthF) by [John Nieves](http://codepen.io/karn09) on [CodePen](http://codepen.io/).
[License](http://codepen.io/karn09/pen/JgthF/license).
@karn09
karn09 / LetterCountI.js
Last active September 12, 2015 18:44
LetterCount I
// LetterCountI, using a sentence as a parameter, function will return the word with the most repeating characters.
function LetterCountI(str) {
var words = str.toLowerCase().split(' '); // take initial str and split into words
var freq = {}; // initialize empty frequency object
var maxWord = ''; //. initialize empty string for storing word with most repeating chars
var maxCh = 1;
// iterate over each word, eventually creating letter frequency hash.
words.forEach(function(word) {
var chars = word.split(''); // initialize array of characters within each word
@karn09
karn09 / pairSum.js
Created September 22, 2015 23:39
PairSum solution
// brute force solution to pairSum, this will check every combination of numbers.
function pairSum (arr, total) {
var arr2 = arr.slice(); // cache copy of array
for (var i = 0; i < arr2.length; i++) {
var current = arr2[i];
for (var j = 0; j < arr2.length; j++) {
// compare running sum against total, make sure indexes don't overlap
if (current + arr2[j] === total && i !== j) {
return true; // will stop when first combo is found
};
@karn09
karn09 / 0_reuse_code.js
Created March 14, 2016 01:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console