Skip to content

Instantly share code, notes, and snippets.

public function openLinkInBackground(url:String):void
{
NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, applicationDeactivateHandler);
navigateToURL(new URLRequest(url));
}
protected function applicationDeactivateHandler(event:Event):void
{
NativeApplication.nativeApplication.removeEventListener(Event.DEACTIVATE, applicationDeactivateHandler);
@rpetrich
rpetrich / index.php
Created October 14, 2010 21:52
Twitter self-hosted image service/url shortener
<?
// Twitter self-hosted image service/url shortener by Ryan Petrich
// Installation:
// 1. Paste this script into the top of your HTTP root's index.php (rename index.html to index.php if it doesn't exist)
// 2. Add the following to your HTTP root's .htaccess file (create .htaccess if it doesn't exist):
// ErrorDocument 404 /index.php
// 3. Create a "s" subfolder and give it 777 permissions
// 4. Add the following as the custom URL for URL shortening in Twitter for iPhone's settings:
// http://yourdomain.com/?d=%@&p=password
// 5. Add the following as the custom URL for Image service:
@jasongraham
jasongraham / less_converter.rb
Created October 22, 2010 04:14
A Jekyll plugin to convert a .less file to .css
module Jekyll
# Compiled LESS CSS into CSS. You must specify an empty YAML front matter
# at the beginning of the file.
# .less -> .css
class LessConverter < Converter
safe true
priority :low
pygments_prefix "\n"
pygments_suffix "\n"
// the old, lame way
protected var _property:Property;
public function get property():Property
{
if (!_property)
{
_property = new Property();
}
@ilkka
ilkka / tag_cloud_tag.rb
Created November 22, 2010 20:07
Jekyll tag cloud / tag pages plugin
module Jekyll
class TagCloudTag < Liquid::Tag
safe = true
def initialize(tag_name, text, tokens)
super
end
def render(context)
html = ""
@mbostock
mbostock / .block
Last active November 22, 2022 23:32
Line Transition
license: gpl-3.0
@codebutler
codebutler / install-tapchat-irssi.sh
Created May 2, 2012 21:40
TapChat for Irssi installer
#!/bin/bash
# TapChat for Irssi Installer
#
# Authors:
# Eric Butler <eric@codebutler.com>
#
# See http://tapchatapp.com for more information
APT_PACKAGES="libanyevent-http-perl libnet-ssleay-perl libuuid-tiny-perl liburi-query-perl libauthen-passphrase-perl libdbd-sqlite3-perl libdbix-class-perl libcrypt-generatepassword-perl libcrypt-cbc-perl libcrypt-rijndael-perl libmime-base64-urlsafe-perl liburi-encode-perl"
@mikeygee
mikeygee / 01-before.html
Created May 7, 2012 07:45
truncate blog posts in jekyll
<!-- using the truncate filter -->
{% for post in site.posts limit:10 %}
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<span class="post-date">{{ post.date | date: "%B %d, %Y" }}</span>
{% if post.content.size > 2000 %}
{{ post.content | truncatewords: 300 }} <!-- bad! content gives you rendered html and you will truncate in the middle of a node -->
<a href="{{ post.url }}">read more</a>
{% else %}
{{ post.content }}
{% endif %}
@railwaycat
railwaycat / mac-switch-meta.el
Created August 28, 2012 13:43
meta key switch
;; Keybonds
(global-set-key [(hyper a)] 'mark-whole-buffer)
(global-set-key [(hyper v)] 'yank)
(global-set-key [(hyper c)] 'kill-ring-save)
(global-set-key [(hyper s)] 'save-buffer)
(global-set-key [(hyper l)] 'goto-line)
(global-set-key [(hyper w)]
(lambda () (interactive) (delete-window)))
(global-set-key [(hyper z)] 'undo)
@railwaycat
railwaycat / Emacs_starter.pl
Last active March 12, 2023 01:26
Start Emacs.app from CLI
#!/usr/bin/perl
# Emacs starter for Emacs mac port
# Thanks to Aquamacs Project and David Reitter
my $args = "";
my $tmpfiles = "";
for my $f (@ARGV) {