<')))>{
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 toUserTimeZone(utc_date, offset){ | |
if (utc_date.slice(-3) !== "UTC") { | |
utc_date += " UTC"; | |
} | |
var local_date = new Date(utc_date); | |
var local_offset = local_date.getTimezoneOffset() * 60000; | |
var utc_time = local_date.getTime() + local_offset; | |
return new Date(utc_time + (3600000 * offset)); | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>React Tutorial</title> | |
<link rel="stylesheet" href="css/base.css" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.16/browser.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> |
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
/* Creates a new queue. A queue is a first-in-first-out (FIFO) data structure - | |
* items are added to the end of the queue and removed from the front. | |
*/ | |
function Queue(){ | |
// initialise the queue and offset | |
var queue = []; | |
var offset = 0; | |
// Returns the length of the queue. |
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 leftpad (str, len, ch) { | |
str = String(str); | |
var i = -1; | |
if (!ch && ch !== 0) ch = ' '; | |
len = len - str.length; | |
while (++i < len) { | |
str = ch + str; | |
} | |
return str; | |
} |
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
<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/API/notification --> | |
<script src="notify.js"></script> | |
<button onclick="notifyMe()">Notify me!</button> |
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 CalculateDistance(lat1, long1, lat2, long2) { | |
// Translate to a distance | |
var distance = | |
Math.sin(lat1 * Math.PI) * Math.sin(lat2 * Math.PI) + | |
Math.cos(lat1 * Math.PI) * Math.cos(lat2 * Math.PI) * Math.cos(Math.abs(long1 - long2) * Math.PI); | |
// Return the distance in miles | |
//return Math.acos(distance) * 3958.754; | |
// Return the distance in meters |
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 getUserDetail(username) { | |
if (userCache[username]) { | |
return Promise.resolve(userCache[username]); | |
} | |
// Use the fetch API to get the information | |
return fetch('users/' + username + '.json') | |
.then(function(result) { | |
userCache[username] = result; | |
return result; |
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
#!/bin/bash | |
echo "installing gcc" | |
sudo rpm --import http://ftp.scientificlinux.org/linux/scientific/5x/x86_64/RPM-GPG-KEYs/RPM-GPG-KEY-cern | |
wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo | |
yum install -y devtoolset-2-gcc-4.8.2 devtoolset-2-gcc-c++-4.8.2 devtoolset-2-binutils devtoolset-2-libstdc++-devel-4.8.2 | |
sleep 2 | |
ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/ | |
hash -r | |
gcc --version |
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
while true; do for i in 02E{{9..5},{6..8}}; do printf "\u${i}O=o>";sleep 0.09;printf "\b\b\b\b\b";done;printf "_";done |