This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Smartphones (portrait and landscape) ----------- */ | |
@media only screen | |
and (min-device-width : 320px) | |
and (max-device-width : 480px) { | |
/* Styles */ | |
} | |
/* Smartphones (landscape) ----------- */ | |
@media only screen | |
and (min-width : 321px) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#siteForm').on('submit', function (e) { | |
$.ajax({ | |
type: "POST", | |
url: $(this).attr('action'), | |
data: $(this).serialize() | |
}).done(function () { | |
$('#sideProof').hide('fast'); | |
$('#rightContent').show('fast'); | |
}); | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// === Arrays | |
var [a, b] = [1, 2]; | |
console.log(a, b); | |
//=> 1 2 | |
// Use from functions, only select from pattern | |
var foo = () => [1, 2, 3]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Grab Children/Parent Node(s) */ | |
var parent = document.getElementById('container'); | |
var children = parent.childNodes; | |
var parentNode = children.parentNode; | |
/* Create New DOM Elements /* | |
var newH1 = document.createElement('h1'); | |
var newPara = document.createElement('p'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uniqueNumber() { | |
var date = Date.now(); | |
if (date <= uniqueNumber.previous) { | |
date = ++uniqueNumber.previous; | |
} else { | |
uniqueNumber.previous = date; | |
} | |
return date; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Create a new repository on GitHub. | |
2. In Terminal, change the current working directory to your local project. | |
git init | |
git add . | |
or: | |
git add --all | |
git commit -m 'First commit' | |
git remote add origin <remote repository URL> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Markup | |
<input type="checkbox" id="checkbox"/><label for="checkbox">Checkbox</label> | |
Simulate click <input type="button" onclick="simulateClick();" value="Simulate click"/> | |
Add a click handler that calls preventDefault <input type="button" onclick="addHandler();" value="Add a click handler that calls preventDefault"/> | |
Remove the click handler that calls preventDefault <input type="button" onclick="removeHandler();" value="Remove the click handler that calls preventDefault"/> | |
// Script | |
var checkbox = document.querySelector('.checkbox') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="swipezone"> | |
Swipe me | |
</div> | |
// credit: http://www.javascriptkit.com/javatutors/touchevents2.shtml | |
function swipedetect(el, callback){ | |
var touchsurface = el, | |
swipedir, | |
startX, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr1.push(...arr2) // Adds arr2 items to end of array | |
arr1.unshift(...arr2) //Adds arr2 items to beginning of array | |
var arr1 = ['two', 'three']; | |
var arr2 = ['one', ...arr1, 'four', 'five']; | |
// ["one", "two", "three", "four", "five"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Some that you can use the project | |
// DATA LIST | |
<input list="browsers"> | |
<datalist id="browsers"> | |
<option value="Internet Explorer"> | |
<option value="Firefox"> | |
<option value="Chrome"> | |
<option value="Opera"> |
OlderNewer