This file contains 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
private func setBackgroundColor(redColor: Int, greenColor: Int, blueColor: Int) -> Bool{ | |
// colors should be from 0 to 255, like you get when picking colors in Photoshop | |
if redColor < 0 || greenColor < 0 || blueColor < 0 { | |
println("At least one color value not in range. Must be at least 0") | |
return false | |
} | |
if redColor > 255 || greenColor > 255 || blueColor > 255 { | |
println("At least one color value not in range. Must be at less than 255") | |
return false | |
} |
This file contains 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 Person = function(name) { | |
this.name = name; | |
} | |
Person.prototype.getName = function() { | |
return this.name; | |
} | |
var thomas = new Person("thomas") |
This file contains 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 Person = function(name) { | |
this.name = name; | |
} | |
Person.prototype.getName = function() { | |
return this.name; | |
} | |
var thomas = new Person("thomas") |
This file contains 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
// ah, wrap the function in parentheses! | |
Number.prototype.times = (function(theString) { | |
this.theString = theString; | |
var result = ""; | |
for (var i = 0; i< this; i++){ | |
result += this.theString; | |
} | |
//return this + " ; " + this.theString; | |
return result; |
This file contains 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
Number.prototype.isCreditCard = ( | |
function() { | |
var testCC = this.toString(); | |
var sum =0; mul = 1; l = testCC.length; | |
if (l < 19) { | |
for (i = 0; i < l; i++) | |
{ | |
var digit = testCC.substring(l-i-1,l-i); | |
var tproduct = parseInt(digit ,10)*mul; |
This file contains 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. Change the addEventListener calls so that the events occur in the following order. | |
the_div! the_item! the_list! --> | |
<div id="the_div"> | |
<ul id="the_list"> | |
<li id="the_item">Click me!</li> | |
</ul> | |
</div> | |
<p id="log"></p> |
This file contains 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
img { | |
display: block; | |
} |
This file contains 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
class InfoPanel extends React.Component { | |
// a pre-defined style | |
scrollBarStyle = { | |
top: 0, | |
position: 'absolute', | |
width: '18px', | |
height: 54, | |
background: '#434344' | |
} |
This file contains 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
// -- I didn't make this but it's really handy! - John | |
/// Convert angle | |
/// @author Chris Eppstein | |
/// @param {Number} $value - Value to convert | |
/// @param {String} $unit - Unit to convert to | |
/// @return {Number} Converted angle | |
@function convert-angle($value, $unit) { | |
$convertable-units: deg grad turn rad; | |
$conversion-factors: 1 (10grad/9deg) (1turn/360deg) (3.1415926rad/180deg); |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Page Refresher</title> | |
</head> | |
<body> | |
<h1>Page Refresher</h1> | |
<p>Drag the link below to your toolbar to install the "page refresher" bookmarklet. Press the bookmarklet and you will be prompted for when you'd like the page you're on to be refreshed in your browser.</p> | |
<a href="javascript: (function () { var jsCode = document.createElement('script'); jsCode.setAttribute('src', 'https://gist.githubusercontent.com/johnfmorton/9238562/raw/b2a65b62c17569d3d275b9f2a755d14658e8d036/pagerefresher.js'); document.body.appendChild(jsCode); }());">Refresher</a> |
OlderNewer