Skip to content

Instantly share code, notes, and snippets.

for ( tr of document.querySelectorAll('tr[class=" "]') ) {
const s = tr.querySelector('select')
if (!s) continue;
const a = tr.querySelector('a')
a.click();
var [from, to] = tr.querySelectorAll('td.td-attendance-time input')
from.value = '10:00';
to.value = '19:00';
}
@ku
ku / git-backup-to-AWS-S3.sh
Last active December 27, 2016 08:05 — forked from philippb/git-backup-to-AWS-S3.sh
Complete git repository backup script to AWS S3 with aws command
#!/bin/bash
# Script to backup git repo to S3
# Set bucket, dir, password and account to use for the backup. I keep mine in local env vars
# These are set by localrc which lives on an encrypted home directory and is executed by my bashrc
bucket=$S3_BACKUP_BUCKET
dest=$S3_DIR
dir=$GITHUB_BACKUP_DIR
account=$GITHUB_ACCOUNT
@ku
ku / transclude.js
Created October 14, 2016 03:20
esa.io transclude
(function() {
var me = document.scripts[document.scripts.length - 1];
var token = me.src.match(/token=(\w+)/)[1];
var q = 'dev/esa/api name:v1'
var u = 'https://api.esa.io/v1/teams/docs/posts?access_token=' + token + '&q=' + q;
fetch(u).then(function (r){
r.json().then(function(r){
r.posts.forEach(function (post) {
Object.keys(Case).map(function (k) {
if (Case[k] instanceof Function) {return k}
}).filter(function (x) {return x} ).reduce(function (h, k) {
h[k] = Case[k]("attrClass"); return h
}, {})
{
"of": "camel",
"flip": "ATTRcLASS",
"random": "aTTrClaSs",
@ku
ku / app.coffee
Last active December 25, 2015 09:55
angular 1.x hot module reload
require 'angular'
require 'angular-route'
window.app = app = angular.module('kz.app', [
'ngRoute'
])
@ku
ku / locale2json
Created December 11, 2014 06:18
convert rails locale files into one json
#!/usr/bin/env ruby
#run in RAILS_ROOT directory
require 'json'
require 'yaml'
# http://stackoverflow.com/questions/9381553/ruby-merge-nested-hash
class ::Hash
def deep_merge(second)
merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
@ku
ku / Gemfile
Last active August 29, 2015 14:09
browserstack automation
source 'https://rubygems.org'
gem 'selenium-webdriver'
@ku
ku / gist:84af637e2d9b82ac307b
Created November 7, 2014 08:50
random sqwiggle snapshot changer
require 'sqwiggle-ruby'
require 'net/http'
require 'nokogiri'
require 'uri'
token = 'cli_be6cd40b6ebd25101b3450e34882412b'
flickr_rss = 'https://www.flickr.com/services/feeds/photos_public.gne?id=59591873@N00&lang=en-us'
uri = URI.parse(flickr_rss)
@ku
ku / ticketmachine
Created October 28, 2014 04:09
ticketmachine
#!/usr/bin/env coffee
#
JiraApi = require('jira').JiraApi
#process = require 'process'
exec = require('child_process').exec
if process.argv.length < 1 + 2
console.log "usage: ticketmachine sumamry [description]"
return 1
[summary, description] = process.argv.slice 2
if ($this->posts[0]->tumblr_url) {
header( "Location: " . $this->posts[0]->tumblr_url, true, 301);
exit;
}
}
// Put sticky posts at the top of the posts array
"wp-includes/query.php" 4399 lines --76%--