Skip to content

Instantly share code, notes, and snippets.

View leemeichin's full-sized avatar
:shipit:

Lee Meichin leemeichin

:shipit:
View GitHub Profile
@leemeichin
leemeichin / mode-line.el
Created November 7, 2012 16:51
Customising your emacs mode-line
;; Sets the default mode-line. Remove '-default' if you want to test your changes on-the-fly with (eval-buffer)
(setq-default mode-line-format
'(
;; add a noticeable red block that says 'READ ONLY' when the file's, er, read only
(:eval
(when (eql buffer-read-only t)
;; propertize adds metadata to text, so you can add colours and formatting, amongst other things
(propertize " READ ONLY " 'face
'(:background "color-88" :foreground "white" :weight bold))))
;; show the buffer filename, with a green background when unmodified/saved and a red one when modified
@leemeichin
leemeichin / README.md
Created April 12, 2012 12:02
Modulo Liquid filter for Jekyll

Modulo Liquid filter for Jekyll

Got nested columns in your grid-based Jekyll site?

Wondered why you didn't have a way to calculate the modulo inside your posts loop to open and close your 'rows' containing those nested columns?

Add this filter to your _plugins directory, and use it like so:

{{ x | mod:y }}
@leemeichin
leemeichin / README.md
Created March 6, 2020 17:47
worktree.sh

Usage:

worktree init master sets your repo up for worktrees. e.g. if you have a repo called noel-edmonds the result would become this:

/noel-edmonds # container directory for your worktrees
  |- /master # main worktree branch (do not check out new branches from here!)
    |- .git/
@leemeichin
leemeichin / README.md
Last active December 18, 2019 08:29
CircleCI 2.0 - Merge parallel coverage results for CodeClimate

CircleCI 2.0 Parallel Builds and CodeClimate

Add the Ruby script to your repo, and add this snippet into your new circle.yml:

- deploy:
    name: Merge and copy coverage data
    command: bundle exec path/to/circle.rb
@leemeichin
leemeichin / url_validator.rb
Created July 20, 2012 15:02
Rails Custom URL Validator
class UrlValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors[attribute] << (options[:message] || "must be a valid URL") unless url_valid?(value)
end
# a URL may be technically well-formed but may not actually be
# valid, so this checks for both.
def url_valid?(url)
url = URI.parse(url) rescue false
url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)
@supports(display: grid) {
// do a bunch of grid stuff
}
@supports(text-decoration: blink) {
* {
text-decoration: blink;
}
}
@leemeichin
leemeichin / keybase.md
Created September 30, 2017 15:35
keybase.md

Keybase proof

I hereby claim:

  • I am leemachin on github.
  • I am habibi (https://keybase.io/habibi) on keybase.
  • I have a public key whose fingerprint is 731B 4499 5E17 D616 E6B3 4D74 167A 46E6 F5CF A323

To claim this, I am signing this object:

@leemeichin
leemeichin / CLI.md
Last active July 21, 2017 18:03
Zozz

zozz

Demonstrates how to work with Zozz by building itself.

parrot word (other-words...)

Repeats what you say (example for optional and splatting args)

build

@leemeichin
leemeichin / app.js
Last active March 24, 2017 14:02
tf-liedetector
var ApiBuilder = require('claudia-api-builder')
var pg = require('pg')
var request = require('request-promise-native')
var find = require('lodash.find')
var api = new ApiBuilder()
var sentimentUrl = "http://sentiment.vivekn.com/api/text/"
// Check for auth as a strange kind of middleware thing
function requiresAuth(req, fn) {