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 { useRef } from 'react' | |
/** | |
* This could also be called `useDerived`. Works like useMemo, | |
* except it guarantees that it only executes once per change of dependency values, | |
* which is what `useMemo` is often expected to do, but doesn't guarantee, and doesn't | |
* do in strict mode. | |
* | |
* Differs from `useEffect` in that the value is computed synchronously during render | |
*/ |
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
#!/bin/bash | |
## This script uses the `convert` command from the imagemagick library to add a watermark to one or more images | |
WATERMARK= # add your default watermark here | |
WSIZE="20%" | |
WPADDING="0" | |
GRAVITY=SouthEast | |
OUTDIR=watermarked | |
DRYRUN= | |
VERBOSE= |
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
// Fixed an error with character replacement, removed a dependency, included imports, throw errors, and fixed global variables | |
var crypto = require('crypto'); | |
//remove a dependency on b64url | |
function atob(str) { | |
return new Buffer(str, 'base64').toString('binary'); | |
} | |
//this is not used here, but to leave it out would be like passing the salt without the pepper. | |
function btoa(str) { |
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
Drag this link to your bookmark bar to save as a bookmarklet: | |
<a href="javascript:var s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='https://rawgit.com/bgmort/0fcf5971fe80e2c8ac13737caf9aa9b2/raw/mightytext-masstext.js'; void 0">Mighty Mass Text</a> |
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
# run_multiple_commands.py | |
import sublime, sublime_plugin | |
# Takes an array of commands (same as those you'd provide to a key binding) with | |
# an optional context (defaults to view commands) & runs each command in order. | |
# Valid contexts are 'text', 'window', and 'app' for running a TextCommand, | |
# WindowCommands, or ApplicationCommand respectively. | |
class RunMultipleCommandsCommand(sublime_plugin.TextCommand): | |
def exec_command(self, command): | |
if not 'command' in command: | |
raise Exception('No command name provided.') |
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
<script type="text/javascript"> | |
(function($){ | |
var matches = location.pathname.match(/browse\/([A-Z]+-[0-9]+)/); | |
if (matches) { | |
$(document).ready(function() { | |
/* | |
* Add diffs to change logs | |
*/ | |
var 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
/** | |
* converts like objects into a format which will serialize to a more compact JSON string | |
*/ | |
function listToTable (list, cols){ | |
var table = {}; | |
for (var i = 0, item; item= list[i], i < list.length; i++){ | |
for (var key in item){ | |
if (item.hasOwnProperty(key)){ | |
if (!table[key]) table[key] = []; | |
table[key][i] = item[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
<script type="text/javascript"> | |
/* | |
* add an 'edit all' option to issue pages | |
*/ | |
(function(){ | |
if (location.pathname == '/issues/' && location.hash == '#editall') { | |
location.href = '/secure/views/bulkedit/BulkEdit1!default.jspa?reset=true' | |
} | |
else { | |
var matches = location.pathname.match(/browse\/([A-Z]+-[0-9]+)/); |
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
/** | |
* Simple jquery function to trim a line of text with ellipses on left side, | |
* like text-overflow: ellipsis clip will in Firefox only. Changes the text | |
* permanently, so the amount of text hidden will not change when the window | |
* is resized. | |
* For this to work, the element you pass in needs to have overflow: hidden | |
* and white-space: nowrap; | |
* | |
* http://stackoverflow.com/questions/9793473/text-overflow-ellipsis-on-left-side | |
*/ |
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 Jira: Edit all sub-tasks | |
// @description Open subtasks of a story in search so they may all be modified at once | |
// @match http://jira.your.company.com/browse/* | |
// ==/UserScript== | |
(function(){ | |
var matches = location.pathname.match(/[A-Z]+-[0-9]+/), | |
list, id, item, link; | |
NewerOlder