Skip to content

Instantly share code, notes, and snippets.

@guich-wo
guich-wo / highlight-ruby.applescript
Created February 14, 2018 13:06
Applescript to highlight ruby code in Pages
# Applescript to highlight ruby code in Pages
# Requirements : Pygments (http://pygments.org/languages/) : pip install Pygments
# Tutorial: https://shomeya.com/articles/screencast-how-to-add-syntax-highlighting-to-pages-and-keynote
try
set old to the clipboard as record
end try
tell application "System Events" to keystroke "c" using command down
do shell script "export LC_CTYPE=UTF-8; pbpaste | /usr/local/bin/pygmentize -l ruby -f rtf -O style=default | pbcopy -Prefer rtf"
tell application "System Events" to keystroke "v" using command down
delay 0.05
@guich-wo
guich-wo / abilities.rb
Last active March 6, 2017 16:30 — forked from ryanb/abilities.rb
How you can break up large Ability class in CanCan
module Abilities
def self.ability_for(user)
AdminAbility.new(user) if user.admin?
MemberAbility.new(user) if user.member?
# etc...
end
class AdminAbility
include CanCan::Ability

Keybase proof

I hereby claim:

  • I am guich-wo on github.
  • I am guillaumedufloux (https://keybase.io/guillaumedufloux) on keybase.
  • I have a public key whose fingerprint is 44FC A011 1A90 E385 3F44 10F1 FF88 6686 C790 6626

To claim this, I am signing this object: