⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,
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
# Put this function to your .bashrc file. | |
# Usage: mv oldfilename | |
# If you call mv without the second parameter it will prompt you to edit the filename on command line. | |
# Original mv is called when it's called with more than one argument. | |
# It's useful when you want to change just a few letters in a long name. | |
# | |
# Also see: | |
# - imv from renameutils | |
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste) |
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
## Pre-requisite: You have to know your last commit message from your deleted branch. | |
git reflog | |
# Search for message in the list | |
# a901eda HEAD@{18}: commit: <last commit message> | |
# Now you have two options, either checkout revision or HEAD | |
git checkout a901eda | |
# Or | |
git checkout HEAD@{18} |
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
<figure class="video-player"> | |
<video preload="none" width="1280" height="720" poster="video.jpg"> | |
<source src="video.webm" type="video/webm" /> | |
<source src="video.mp4" type="video/mp4" /> | |
</video> | |
<button class="play-toggle">Toggle play</button> | |
<button class="mute-toggle">Toggle mute</button> | |
</figure> | |
<script> | |
// Initialize video player |
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
# Tested on OSX Yosemite 10.10.4 | |
# there is also an updated version (work in progress) for El Capitan here https://gist.github.com/guycalledseven/31ffe35eca056838b06b | |
# XXX TODO | |
# should I disable com.google.Keystone.Agent ?? | |
# http://applehelpwriter.com/2014/07/13/how-to-remove-googles-secret-update-software-from-your-mac/ | |
# Stop DS_Store file creation on network connections | |
# restart Finder afterwards |
##JS Simple Image Expand
A simple Javascript plugin that shows an image in full size on click, and should be compatible up to IE6.
####Basic usage:
In the <head>
tag, include:
<script type="text/javascript" src="your/path/to/simple-image-zoom.min.js"></script>
Before the closing </body>
tag, include:
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 class shows uses version 0.28.7 of the ruby google-api-client gem circa April 2019 | |
# to query the Google Play subscription API. | |
# | |
# If using an older version of the google-api-client gem (ie. version 0.8.x), instead refer to: | |
# https://gist.github.com/jkotchoff/e60fdf048ec443272045/e3e2c867633900d9d6f53de2de13aa0a0a16bb03 | |
# | |
# Sample usage: | |
# | |
# package_name = 'com.stocklight.stocklightapp' | |
# product_id = 'com.stocklight.stocklight.standardsubscription' |
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 id="if_equals_example" type="text/x-handlebars-template"> | |
{{#if_equals objectType 'message'}} | |
<div class="message"> | |
Message | |
</div> | |
{{else}} | |
{{/if_equals}} | |
</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
#!/bin/bash | |
usage() { | |
cat << EOF | |
Usage: $0 [OPTION]... COMMAND | |
Execute the given command in a way that works safely with cron. This should | |
typically be used inside of a cron job definition like so: | |
* * * * * $(which "$0") [OPTION]... COMMAND | |
Arguments: |
NewerOlder