Skip to content

Instantly share code, notes, and snippets.

// This work is licensed under the Creative Commons Attribution 3.0 United States License. To view
// a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ or send a letter
// to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
// Copyright 2009 John Tantalo <john.tantalo@gmail.com>
(function () {
// get selection
var selection = window.getSelection ? window.getSelection() :
document.getSelection ? document.getSelection() :
@LucasLarson
LucasLarson / asciify-hexify.js
Last active April 16, 2019 02:13
ASCIIfy–Hexify: A bookmarklet to find a character’s ASCII and hexadecimal value
/**
* ASCIIfy–Hexify bookmarklet
* v.92
*
* Authors: Lucas Larson, 2017
* Steve Kangas, 1998
*
* Description: This is the JavaScript behind a bookmarklet to obtain the
* ASCII₁₀ value and hexadecimal value of any single character.
*
@vancetran
vancetran / wget-static.md
Last active January 5, 2020 10:26
Wget recipes

Make a static copy of a dynamic site, including images

via Stanford

wget -P /destination/ -mpck --user-agent="" -e robots=off --random-wait -E http://example.com/

Without Images, PPT, PDF

source

#!/usr/bin/env ruby
require 'tempfile'
require 'fileutils'
def usage
print "usage: xcode-textencoding [project-file] [text-encoding-name]\n"
print " project-file a file path of Xcode project (ex. some.xcodeproj)\n"
print " text-encoding-name screen name of text encoding\n"
end
##
# This is an adoption from Oh My Zsh for Google Cloud Shell
##
main() {
# Install zsh
sudo apt-get -qq update
sudo apt-get -qq install zsh -y
@dsculptor
dsculptor / transmit-iterm-patch.applescript
Last active September 1, 2021 08:33 — forked from johnfmorton/TransmitOpenTerminal.txt
Use Transmit 5 to open in iTerm (instead of Terminal.app). Ref: https://library.panic.com/transmit5/open-in-terminal/
-- Run the following cmd to make Transmit marry iterm2 as its Terminal partner:
-- defaults write com.panic.Transmit OpenTerminalScriptPath ~/transmit-iterm-patch.applescript
on openTerminal(location, remoteHost, serverPort)
-- Prepare sshCmd and cmd:
set sshCmd to ""
set cmd to "cd \"" & location & "\""
if ((count of remoteHost) is greater than 0) then
set sshCmd to "ssh " & remoteHost
@d0k
d0k / gist:3608547
Last active February 21, 2022 23:34
clang warning flags
-W
-Wextra
-Wmissing-field-initializers
-Wignored-qualifiers
-Winitializer-overrides
-Wsemicolon-before-method-body
-Wmissing-method-return-type
-Wsign-compare
-Wunused-parameter
-W#pragma-messages
@sindresorhus
sindresorhus / git-dirty-checks.md
Created October 16, 2012 11:20
Benchmark results of the fastest way to check if a git branch is dirty

Tested against the WebKit git repo by entering the repo with 1 file dirty.


git diff --quiet --ignore-submodules HEAD # Will tell if there are any uncomitted changes, staged or not.
0.6 sec

git diff-index --quiet HEAD # Only tracked
2 sec

@LucasLarson
LucasLarson / ShowAnchors.js
Last active December 2, 2022 15:16 — forked from inkarkat/ShowAnchors.js
Improved “Show Anchors” bookmarklet from Ingo Karkat’s https://gist.github.com/inkarkat/cd1d40996a1f818dfc71, which is an improvement on the bookmarklet here: http://sensefulsolutions.com/2009/12/show-anchors-bookmarklet.html
javascript:(function(){function%20a(n,t){return'<a%20href="'+loc+"#"+n+'"%20title="'+t+":%20"+n+'"%20style="text-decoration:none;padding:.2em;background:#fff;border:1px%20solid%20black;display:block;position:absolute;z-index:2147483647;border-radius:3px;-webkit-box-shadow:0%203px%207px%20rgba(0,0,0,0.3);box-shadow:0%203px%207px%20rgba(0,0,0,0.3)">#'+n+"</a>"}var%20$,loc=location.href,anchorPos=location.href.lastIndexOf("#");anchorPos>-1&&(loc=loc.substring(0,anchorPos)),function(u,c){var%20h=document.getElementsByTagName("head")[0],s=document.createElement("script");s.src=u;var%20d=!1;s.onload=s.onreadystatechange=function(){d||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(d=!0,c(),s.onload=s.onreadystatechange=null,h.removeChild(s))},h.appendChild(s)}("//code.jquery.com/jquery-3.3.1.min.js",function(){$=jQuery,$("a[name]").each(function(i){$(a(this.name,"name")).insertBefore(this)}),$("[id]:not(input[type='hidden'])").each(function(i){switch(this.nodeName){case"TD":$(this).prepend
@vdsabev
vdsabev / download.js
Last active June 30, 2023 02:14
Bookmarklet - download all links on a page
javascript:(() => {
const items = document.querySelectorAll('a');
let delay = 0;
for (let index = 0; index < items.length; index++) {
const item = items[index];
item.setAttribute('download', item.getAttribute('href'));
setTimeout(() => item.click(), delay);
delay += 500;
}
})();