Skip to content

Instantly share code, notes, and snippets.

View dunn's full-sized avatar
💭
no

Alexandra Catalina dunn

💭
no
View GitHub Profile
@duckinator
duckinator / duck-typing.rb
Created December 9, 2014 05:06
Duck typing, explained with Ducks.
# This is a Duck. It is clearly not a string.
class Duck
def to_s
" _ \n" +
"__(.)<\n" +
"\\___) \n"
end
end
# This displays Strings. It will clearly never display a Duck.
(defun decode-entities (dirty-string)
"Interprets a string of space-separated numbers as an
ASCII string"
(mapconcat (lambda (x) (format "%c" (string-to-number x)))
(split-string (clean-encoded-string dirty-string))
""))
(defun clean-encoded-string (string)
"Removes useless characters and replaces linebreaks with a
line-feed (LF) char."
@sgss
sgss / Info.plist
Created February 4, 2012 17:51
CoffeeScript BBEdit Language Module
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>11B26</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>CoffeeScript</string>
@rmuslimov
rmuslimov / dired-features.el
Last active February 15, 2016 03:22
Small extension for dired under Macosx
(setq
scripts-dired-find-owner
"tell application \"Finder\"
set appname to (default application of (info for POSIX file \"%s\"))
do shell script \"echo \" & appname
end tell")
(setq
scripts-dired-open-from-finder
@nertzy
nertzy / README
Created December 9, 2012 22:32 — forked from symposion/README
Convert OS X Keychain exported entries into logins for 1Password import
These two files should help you to import passwords from mac OS X keychains to 1password.
Assumptions:
1) You have some experience with scripting/are a power-user. These scripts worked for me
but they haven't been extensively tested and if they don't work, you're on your own!
Please read this whole document before starting this process. If any of it seems
incomprehensible/frightening/over your head please do not use these scripts. You will
probably do something Very Bad and I wouldn't want that.
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they
@escowles
escowles / gist:7572678
Created November 20, 2013 22:55
stacktrace when loading 4GB file into fcrepo4 using leveldb instead of file storage
INFO 17:54:23.546 (WildcardExceptionMapper) Exception intercepted by WildcardExceptionMapper:
org.modeshape.jcr.value.ValueFormatException: Error converting InputStream to a BinaryValue
at org.modeshape.jcr.value.binary.BinaryStoreValueFactory.create(BinaryStoreValueFactory.java:268) ~[modeshape-jcr-3.6.0.Final.jar:3.6.0.Final]
at org.modeshape.jcr.value.binary.BinaryStoreValueFactory.create(BinaryStoreValueFactory.java:57) ~[modeshape-jcr-3.6.0.Final.jar:3.6.0.Final]
at org.modeshape.jcr.JcrValueFactory.createBinary(JcrValueFactory.java:153) ~[fcrepo-kernel-4.0.0-alpha-3-SNAPSHOT.jar:na]
at org.modeshape.jcr.JcrValueFactory.createBinary(JcrValueFactory.java:47) ~[fcrepo-kernel-4.0.0-alpha-3-SNAPSHOT.jar:na]
at org.fcrepo.kernel.Datastream.setContent(Datastream.java:152) ~[fcrepo-kernel-4.0.0-alpha-3-SNAPSHOT.jar:na]
at org.fcrepo.kernel.services.DatastreamService.createDatastreamNode(DatastreamService.java:138) ~[fcrepo-kernel-4.0.0-alpha-3-SNAPSHOT.jar:na]
at org.fcrepo.http.api.FedoraContent.creat
@samdeane
samdeane / fixgit.sh
Created August 19, 2012 13:26
Script to move a git repo containing absolute gitdir and worktree submodule paths
#!/usr/bin/env bash
# Fix up a git repo containing submodules that have absolute paths which have changed.
#
# Note that this doesn't do the *proper* fix, which is to turn the absolute paths into
# relative paths. This is possible, but would require a lot more logic because the relative
# paths would be different in each case.
#
# What it does instead is a pragmatic workaround, which is to search & replace the old
# path with a new (and presumably correct) one. This will get you up and running again.
@parkr
parkr / generator_scss.rb
Created June 5, 2012 13:19
Jekyll Plugin to output SCSS without requiring the "---" YAML Front Matter
#
# Jekyll Generator for SCSS
#
# (File paths in this description relative to jekyll project root directory)
# Place this file in ./_plugins
# Place .scss files in ./_scss
# Compiles .scss files in ./_scss to .css files in whatever directory you indicated in your config
# Config file placed in ./_sass/config.rb
#
@johnholdun
johnholdun / mastodon-parser.rb
Created April 19, 2017 16:20
Turn a Mastodon permalink URL into a one-line plain text status
require 'nokogiri'
require 'open-uri'
require 'upmark'
require 'cgi'
require 'uri'
class TootReader
ACTIVITY_NAMESPACE = 'http://activitystrea.ms/spec/1.0/'.freeze
COMMENT_TYPE = 'http://activitystrea.ms/schema/1.0/comment'.freeze
default: all
SRC := $(wildcard *.c)
EXE := $(SRC:.c=)
all: $(EXE)
%: %.c
clang $< -o $@