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
var myScript = document.createElement('script'); | |
myScript.src = 'http://code.jquery.com/jquery-2.1.4.min.js'; | |
myScript.onload = function() { | |
console.log('jQuery loaded.'); | |
}; | |
document.body.appendChild(myScript); |
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
/* base font size + viewport height + viewport width */ | |
h1 { | |
font-size: calc(2rem + 4vh + 4vw); | |
} | |
/* responsive font-size responsive */ | |
html { | |
font-size: calc(100% + .2vh + .2vw); | |
} |
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
/* | |
This is for multiline comments | |
It will output into your CSS depending on your mode. | |
If you are using the compressed mode, this will be removed. | |
*/ | |
/* This can be used for inline comments */ | |
/*! | |
This is for multiline comments. |
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
print "This s**t is bananas" | |
for a in "bananas": | |
print a |
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
.nav-tab { | |
... | |
// instead of putting it on | |
border-right: 1px solid #424242; | |
&:last-child { | |
border-right: 0; // and then taking it off | |
} | |
// use CSS not() to only apply to the elements you want | |
&:not(:last-child) { | |
border-right: 1px solid #424242; |
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
// returns first element selected - $('input[name="food"]') | |
var $ = document.querySelector.bind(document); | |
// return array of selected elements - $$('img.dog') | |
var $$ = document.querySelectorAll.bind(document); | |
// Credit: https://twitter.com/wesbos/status/608341616173182977 |
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
var myImg = document.querySelector('img'), | |
op = document.querySelector('output'); | |
op.innerHTML = "Computed width: " + | |
getComputedStyle(myImg).getPropertyValue('width') + | |
'<br>' + 'img.width: ' + | |
myImg.width + | |
'<br>' + 'getAttribute(width): ' + | |
myImg.getAttribute('width') + | |
'<br>' + 'img.naturalWidth: ' + |
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
const SourceElement = React.createClass({ | |
componentDidMount: f() { | |
this.props.view.addSource(this.props.source); | |
}, | |
componentWillUnumount: f() { | |
this.props.view.removeSource(this.props.source); | |
}, | |
componentWillReceiveProps: f(nextProps) { |
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 class="container"> | |
<form class="form"> | |
<div class="form-group"> | |
<label class="sr-only" for="emailAddress">Email Address</label> | |
<input class="form-control input-lg" type="email" placeholder="[email protected]" id="emailAddress" required> | |
<button type="submit" class="btn btn-default input-lg">Subscribe</button> | |
</form> | |
</div> |
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
var myString = 'EXAMPLEstring'; | |
var myNewString = myString.replace(/[A-Z]/g, '0'); | |
console.log(myNewString); | |
function replaceFunc (a, b, c) { | |
console.log(a, b, c); | |
return a.toLowerCase(); | |
} | |
var myOtherString = myString.replace(/[A-Z]/g, replaceFunc); |