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 $window = $(window) | |
/* Restore scroll position */ | |
window.scroll(0, localStorage.getItem('scrollPosition')|0) | |
/* Save scroll position */ | |
$window.scroll(function () { | |
localStorage.setItem('scrollPosition', $window.scrollTop()) | |
}) |
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
Show hidden characters
{ | |
"force_override": true, | |
"size": 11 | |
} |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Weather</title> | |
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script type="text/javascript" src="main.js"></script> | |
</head> | |
<body> |
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
require 'json' | |
pets = File.open("file.json", "r") | |
doc = "" | |
pets.each do |line| | |
doc << line | |
end | |
pets.close |
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
puts "Text please: " | |
text = gets.chomp | |
words = text.split(" ") | |
frequencies = Hash.new(0) | |
words.each { |word| frequencies[word] += 1 } | |
frequencies = frequencies.sort_by {|a, b| b } | |
frequencies.reverse! |
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
movies = { | |
Memento: 3, | |
Primer: 4, | |
Ishtar: 1 | |
} | |
puts "What would you like to do?" | |
puts "-- Type 'add' to add a movie." | |
puts "-- Type 'update' to update a movie." | |
puts "-- Type 'display' to display all movies." |
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 fs = require('graceful-fs'); | |
var ncp = require('graceful-ncp').ncp; | |
// var FileQueue = require('filequeue'); | |
// var fq = new FileQueue(100); | |
ncp.limit = 16; | |
fs.readdir(__dirname, function(err, files) { | |
for (var i = 0; i < files.length; i++) { | |
ncp(files[i], 'C:/path/to/output/folder', function(err) { | |
if (err) { | |
return console.error(err); |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
a: <input type="number" name="a" id="a"><br> | |
b: <input type="number" name="b" id="b"><br> | |
<button onclick="add(document.getElementById('a').value, document.getElementById('b').value)">Add</button> |
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
// Convert from degrees to radians. | |
Math.radians = function(degrees) { | |
return degrees * Math.PI / 180; | |
} | |
Math.radians(90); // 1.5707963267948966 | |
// Convert from radians to degrees. | |
Math.degrees = function(radians) { | |
return radians * 180 / Math.PI; | |
} |
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
function getRandomColor() { | |
var letters = '0123456789ABCDEF'.split(''); | |
var color = '#'; | |
for (var i = 0; i < 6; i++) { | |
color += letters[Math.floor(Math.random() * 16)]; | |
} | |
return color; | |
} | |
function getRandomColor() { |
OlderNewer