A Pen by Abhinay Omkar on CodePen.
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
console.log('popstate handle'); | |
$(window).on("popstate", function(e) { | |
e.preventDefault(); | |
if (e.originalEvent.state !== null) { | |
// window.location.reload(); | |
} | |
window.location.reload(); | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
// Early Binding vs Late Binding | |
// Early Binding | |
var sum = function(a, b) { | |
return a + b; | |
}; | |
var x = 5, y = 6; | |
var sum5n6 = sum.bind(null, x, y); |
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 d = '01 Jan 2015'; | |
document.querySelector('#toDate').value = d; | |
document.querySelector('#fromDate').value = d; | |
// Annual Leave | |
document.querySelector('#leaveTypeCategory').value = 10; | |
// Work from home | |
// document.querySelector('#leaveTypeCategory').value = 17; |
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
import requests | |
import json | |
import os | |
FILENAME = 'goodquotes.json' | |
def fetchQuotes(): | |
for page in range(1, 101): | |
quotes_on_page = [] | |
url = "https://api.import.io/store/data/cd22ca4b-5d29-4ff3-9c69-cd372563c051/_query?input/webpage/url=https%3A%2F%2Fwww.goodreads.com%2Fquotes%3Fpage%3D" + str(page) + "&_user=2f7d8fb2-391c-4ddf-823c-633134603fc0&_apikey=T67gIWtTHeLU73sx95D8jtFpWs33Qhe7Ym1xn95IxYTvWjyhD5vM9lK0clQVSvaZ%2BRvZilxmHoD0llECgxGE9Q%3D%3D" |
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
<link rel="import" href="../core-field/core-field.html"> | |
<link rel="import" href="../core-icon/core-icon.html"> | |
<link rel="import" href="../core-input/core-input.html"> | |
<link rel="import" href="../core-icons/core-icons.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { |
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
/* | |
url: facebook.com | |
*/ | |
body, #contentCol, .fbTimelineScrubber { | |
background: #fff; | |
} | |
.fbChatSidebar { | |
display: none ; |
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
import logging | |
# prints log to stdout and also saves to specified log file | |
logger = logging.getLogger('my_logfile') | |
fh = logging.FileHandler('my_logfile.log') | |
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') | |
fh.setFormatter(formatter) | |
ch = logging.StreamHandler() | |
ch.setFormatter(formatter) | |
logger.addHandler(fh) |