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 json | |
import gdata.webmastertools.service | |
import datetime | |
class Downloader(object): | |
HOST = 'www.google.com' | |
APP_NAME = 'Google-WMTdownloadscript-0.1' | |
LIST_PATH = '/webmasters/tools/downloads-list?hl=%s&siteUrl=%s' |
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
module.exports = function(config) { | |
var customLaunchers = require('./saucebrowsers.js'); | |
config.set({ | |
basePath: '', | |
frameworks: ['mocha', 'browserify'], | |
files: [./**/*.js], | |
exclude: [], | |
preprocessors: {}, | |
port: 9876, | |
colors: true, |
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
window.addEventListener("DOMContentLoaded", function() { | |
var selector = "a[href^='http']:not([href*='" + location.hostname + "'])"; | |
Array.prototype.forEach.call(document.querySelectorAll(selector), function(node) { | |
node.target = "_blank"; | |
}); | |
}); |
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
ga(function() { | |
var trackers = ga.getAll(); | |
function trackerObj(tracker) { | |
var keys = tracker.b.data.keys; | |
var tracker_obj = {}; | |
keys.forEach(function(key) { | |
var value = tracker.get(key); | |
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($, undefined) { | |
var digits = function(text) { | |
return (text + "").replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"); | |
}; | |
$.fn.writeowncount = function() { | |
this.clone(true).each(function() { | |
var $this = $(this); | |
var ignore_tags = ["iframe", "a", "blockquote", "script", "div.gist", "pre"]; | |
var ignore_tag_str = ignore_tags.join(","); |
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 calc = { | |
sum: function(array_num) { | |
return _.reduce(array_num, function(memo, num) { | |
return memo + (+num); | |
}, 0); | |
}, | |
ave: function(array_num) { | |
return this.sum(array_num) / array_num.length; | |
}, |
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 isValidDate(date_str) { | |
var date = new Date(date_str), | |
date_reg = /^(\d{4}|\d{2})(?:\x2d|\u002f)(\d{2}|\d)(?:\x2d|\u002f)(\d{2}|\d)/, | |
valid = function() { | |
var date_strs = date_str.match(date_reg), | |
addDateStr = {}; | |
addDateStr.date = function() { | |
return (date.getFullYear() - 0) + (date.getMonth() - 0) + (date.getDate() - 0); |
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
/* | |
* 第2引数でjQueryオブジェクトを返すjQueryプラグイン | |
* $(selector).jeach(function(i, $e) { | |
* $e.text(); // $e -> jquery object | |
* this.tagName; // this -> dom elements | |
* ... | |
* }); | |
*/ | |
(function($) { | |
$.fn.jeach = function(callback) { |
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
<!-- Add the following lines to theme's html code right before </head> --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> | |
<script type="text/javascript" src="http://static.tumblr.com/hkw90bf/Goylylph8/writecapture.js"></script> | |
<script type="text/javascript" src="http://static.tumblr.com/hkw90bf/4j0lylphn/jquery.writecapture.js"></script> | |
<script type="text/javascript" src="http://static.tumblr.com/hkw90bf/Csalymbyn/gitsembedwritecapture.js"></script> | |
<!-- | |
Usage: | |
just add <div class="gists">[gist js URL]</div> |
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() { | |
$('.gists').each(function() { | |
var $this = $(this); | |
var scriptSrc = '<scr'+'ipt src="' + $this.text() + '" type="text/javascript"></scr'+'ipt>'; | |
var isLine = ($this.data('gistline') !== undefined)? true: false; | |
$this.writeCapture().html(scriptSrc, function() { | |
if(isLine === false) return false; | |
$this.each(function() { |
NewerOlder