Discover gists
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
// Cloudflare Worker script to automatically redirect search queries based on trigger words | |
addEventListener("fetch", event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
// status code for redirect response; need something that won't cache | |
var statuscode = 303 | |
// defining base URLs for search engines |
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
// From yesenadam at https://news.ycombinator.com/item?id=23590848 | |
function $(id) { return document.getElementById(id); } | |
function byClass (el, cl) { return el ? el.getElementsByClassName(cl) : [] } | |
function byTag (el, tg) { return el ? el.getElementsByTagName(tg) : [] } | |
function allof (cl) { return byClass(document, cl) } | |
function hasClass (el, cl) { var a = el.className.split(' '); return afind(cl, a) } | |
function addClass (el, cl) { if (el) { var a = el.className.split(' '); if (!afind(cl, a)) { a.unshift(cl); el.className = a.join(' ')}} } | |
function remClass (el, cl) { if (el) { var a = el.className.split(' '); arem(a, cl); el.className = a.join(' ') } } | |
function html (el) { return el ? el.innerHTML : null; } |
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
// From yesenadam at https://news.ycombinator.com/item?id=23590848 | |
function $(id) { return document.getElementById(id); } | |
function byClass (el, cl) { return el ? el.getElementsByClassName(cl) : [] } | |
function byTag (el, tg) { return el ? el.getElementsByTagName(tg) : [] } | |
function allof (cl) { return byClass(document, cl) } | |
function hasClass (el, cl) { var a = el.className.split(' '); return afind(cl, a) } | |
function addClass (el, cl) { if (el) { var a = el.className.split(' '); if (!afind(cl, a)) { a.unshift(cl); el.className = a.join(' ')}} } | |
function remClass (el, cl) { if (el) { var a = el.className.split(' '); arem(a, cl); el.className = a.join(' ') } } | |
function html (el) { return el ? el.innerHTML : null; } |
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
This gist includes components of a oozie workflow - scripts/code, sample data | |
and commands; Oozie actions covered: java mapreduce action; Oozie controls | |
covered: start, kill, end; The java program uses regex to parse the logs, and | |
also extracts the path of the mapper input directory path and includes in the | |
key emitted. | |
Note: The reducer can be specified as a combiner as well. | |
Usecase | |
------- |
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
Quick little visual explainers on the topics and things I tend to forget |
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
/** | |
* Includes the CSS or JS file into the head of the page. | |
* | |
* Examples: | |
* include('http://example.com/script.js') | |
* include('http://example.com/style.css') | |
* include('http://example.com/script.php', 'js') | |
* @param {string} url URL of the CSS or JS file | |
* @param {string} [type] 'css' or 'js' to specify the type of file. | |
* This parameter is optional, but it should be |
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
// ==UserScript== | |
// @name Google Calendar Tasks Killer | |
// @namespace http://zarjay.net/ | |
// @description Removes the "Tasks" item from the "My Calendar" section of Google Calendar | |
// @match https://www.google.com/calendar/* | |
// @version 1.0 | |
// ==/UserScript== | |
// Removes the "Tasks" item from "My Calendar" |
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
// ==UserScript== | |
// @name u.js | |
// @namespace http://zarjay.net/ | |
// @description Utility functions for browser console ninjas | |
// @include * | |
// @version 0.28 | |
// ==/UserScript== | |
exec(function() { | |
// Current version of u.js |
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
// ==UserScript== | |
// @name Open JSON | |
// @version 1.0.0 | |
// @description Opens JSON in a json-viewer window | |
// @match http://*/* | |
// @match https://*/* | |
// ==/UserScript== | |
const exec = fn => { | |
const script = document.createElement('script'); |
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
@mixin build-class($class, $min: 0, $max: 100, $orientation: 'small', $type: 'normal') { | |
.luna-#{$class}-#{$orientation} { | |
color: blue; | |
} | |
} | |
@include build-class('test', 'large'); |
NewerOlder