Skip to content

Instantly share code, notes, and snippets.

ascendbruce /
Last active Aug 5, 2018 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations

Install dependency

Get Homebrew installed on your mac if you don't already have it.

brew install highlight

Highlight your source

ascendbruce /
Last active Aug 13, 2020
error when rake db:migrate with postgresql 9.6 and postgis 2.4. error message Server is version 9.6, library is version 10.0

error message

PG::InternalError: ERROR:  incompatible library "/usr/local/lib/postgresql/": version mismatch
DETAIL:  Server is version 9.6, library is version 10.0.
/Users/bruce/Projects/HB-Backend/db/migrate/20151013213623_enable_postgis.rb:3:in `change'
-e:1:in `<main>'

Caused by:
ascendbruce /
Created Mar 6, 2018
Find filenames contain illegal windows characters on Mac/Linux -- regex pattern match windows reserved characters
# Source:
# reserved characters for filename on windows:
find . -name '*[<>:/\\|?*]*'
ascendbruce /
Last active Nov 30, 2021
Use mac style keyboard shortcuts on Windows with AutoHotkey (ahk) script

Use (most) macOS style keyboard shortcuts on Windows

Make Windows PC's shortcut act like macOS (Mac OS X)

With this AutoHotKey script, you can use most macOS style shortcuts (eg, cmd+c, cmd+v, ...) on Windows with a standard PC keyboard.

Note that:

  1. you shouldn't change the modifier keys mapping with keyboard DIP. This script assumes you use a standard PC keyboard layout, and wish to use shortcuts as if it was a mac keyboard layout.
  2. To use cmd + shift + ↑ / ↓ / ← / → (select text between cursor and top / bottom / beginning of line / end of line), You should disable the Between input languages shotcut from Control Panel\Clock, Language, and Region\Language\Advanced settings > Change lanugage bar hot keys due to conflicting.
ascendbruce / trello-cards-count-bookmarklet.js
Last active Feb 27, 2016
Show cards count bookmarklet for Trello
View trello-cards-count-bookmarklet.js
javascript: ! function() {
$(".js-num-cards").each(function(i) {
var size = $(".js-list:nth(" + i + ") .list-card-details").length;
$(".js-num-cards:nth(" + i + ")").text(size + " cards");
if ($(".board-header-btn-name .js-list-card-count").length === 0) {
$(".board-header-btn-name span").append(" <span class=\"js-list-card-count\"></span>");
ascendbruce / gist:ed51360753edf7ce1fd8
Last active Feb 6, 2016
Fetch facebook graph object scrape information clear cache in command line
View gist:ed51360753edf7ce1fd8
curl -X POST -F "id={the url}" -F "scrape=true" ""
# from
View rubocop_disable_all.yml
# Available cops (199) + config for /Users/bruce/Projects/rails:
# Type 'Lint' (36):
Description: Checks for ambiguous operators in the first argument of a method invocation
without parentheses.
Enabled: false
Description: Checks for ambiguous regexp literals in the first argument of a method
ascendbruce / .pryrc
Last active Aug 29, 2015
rails console customization without modifying Gemfiles
View .pryrc
# encoding: utf-8
# work-around from
required_version_gems = %w(
required_version_gems.each do |version_gem|
View if_unless_bmbm.rb
require 'benchmark'
require "active_support/core_ext/object/blank"
TIMES = 1000000
Benchmark.bmbm do |x|"if present? (actually present)") do
TIMES.times do
if "1".present?
View rails_all_models.rb
# source:
#first load all models
#okay…each now :)
ActiveRecord::Base.send(:subclasses).each do |model|