Skip to content

Instantly share code, notes, and snippets.

View danielbayley's full-sized avatar

Daniel Bayley danielbayley

View GitHub Profile
@mbajur
mbajur / .md
Created April 29, 2016 07:16
How to create small, unique tokens in Ruby

How to create small, unique tokens in Ruby

That is is basically a "fork" of blog article i'm constantly returning to. It seems that the blog is down:

My choice: Dave Bass’s rand().to_s() trick

Dave Bass proposed this which I picked up for my implementation (here for an 8-chars token):

@cvan
cvan / HOWTO.md
Last active May 16, 2025 06:07
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@olih
olih / jq-cheetsheet.md
Last active September 15, 2025 19:50
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@mbostock
mbostock / .block
Last active January 25, 2025 10:54
Polar Clock III
license: gpl-3.0
height: 960
@mbostock
mbostock / .block
Last active October 30, 2022 16:09
Polar Clock II
license: gpl-3.0
height: 960
@rgrove
rgrove / README.md
Created February 8, 2016 19:01
Cake's approach to React Router server rendering w/code splitting and Redux

Can't share the complete code because the app's closed source and still in stealth mode, but here's how I'm using React Router and Redux in a large app with server rendering and code splitting on routes.

Server

  1. Wildcard Express route configures a Redux store for each request and makes an addReducers() callback available to the getComponents() method of each React Router route. Each route is responsible for adding any Redux reducers it needs when it's loaded. (This isn't really necessary on the
@JMichaelTX
JMichaelTX / JXA Resources.md
Last active May 25, 2025 11:13
JavaScript for Automation (JXA) Resources

JXA Resources

Revised: 2019-11-28 16:16 GMT-6

JXA

This is a list of the key resources I have found useful. If you know of others, please post in a comment below, and I will add to this list.

I have tried to order this list in the order that, to me, is best for learning JXA from scratch. We all learn a bit diferently, so adjust to suit your style/needs. Please post if you have suggestions on learning JXA.

@uchcode
uchcode / Building OS X shell script with JavaScript.md
Last active April 14, 2022 13:22
Building OS X shell script with JavaScript

JXAでシェルスクリプト

OS X 10.10 から JavaScript for Automation (JXA) が利用可能になった。ここでは、その Automation 機能をシェルスクリプトとして利用するステップを記述する。

シバン

シェルスクリプトとして利用するので、その前提はターミナルでテキストファイルとして記述する。その際にはファイルを実行するコマンドが何かを記載するシバンが必要。JXA の場合は osascript コマンドを利用する。

#!/usr/bin/env osascript -l JavaScript
#!/usr/bin/perl
# This filter changes all words to Title Caps, and attempts to be clever
# about *un*capitalizing small words like a/an/the in the input.
#
# The list of "small words" which are not capped comes from
# the New York Times Manual of Style, plus 'vs' and 'v'.
#
# 10 May 2008
# Original version by John Gruber:
starlord
sync stars from github -> npm
* must be logged in to npm
* must have git config github.user set? or pass via flag?
- fetch current npm starred
npm stars
- fetch current github starred