Skip to content

Instantly share code, notes, and snippets.

View danielbayley's full-sized avatar
👨‍💻
Working on too many things…

Daniel Bayley danielbayley

👨‍💻
Working on too many things…
View GitHub Profile
@eip
eip / CLR To JSON.applescript.js
Last active December 15, 2024 04:02
Convert Apple Color List (.CLR) to JSON
var app;
var clrFilePath;
var colorList = {};
var jsonFilePath;
var nsColorList;
var nsStringColorList;
var paletteName;
function c2h(colorValue) {
return ('0' + Math.round(colorValue * 255).toString(16)).slice(-2);
@DamnedScholar
DamnedScholar / language-sampleGrammar.cson
Last active July 28, 2024 08:43
Grammar boilerplate with annotations.
# TextMate tutorial: http://manual.macromates.com/en/language_grammars
# Regex to convert keys to unquoted: '(include|match|captures|begin|end|beginCaptures|endCaptures|name|patterns|0|1|2|3|4|5|6|7|8|9|comment|fileTypes|scopeName|repository|contentName|firstLineMatch|foldingStartMarker|foldingStopMarker)':
scopeName: 'source.<scope>' # <scope> should be a short, unique indicator for the language ("js", "php", "c", etc.)
name: '<name>' # The title that will show up in grammar selection and on your status bar.
fileTypes: [ # An array of file extensions.
'txt'
'exif'
]
@uchcode
uchcode / JXAReader.js
Last active April 14, 2022 11:34
JXA with Require
//
// JXAReader.js
//
// Created by uchcode on 2016/05/28.
// Copyright © 2016 uchcode. All rights reserved.
//
function read(fname) {
function LibPath(fname, resourcePath) {
return $(resourcePath + '/Script Libraries/' + fname).stringByStandardizingPath.js

Mac OS X Traffic Lights

Useful in Electron apps when the default title bar must be hidden. There are some slight issues with this rendering in browser, but it looks perfect inside Electron :)

A Pen by atdrago on CodePen.

License.

@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 February 27, 2025 14:41
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 May 9, 2025 03:13
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