Skip to content

Instantly share code, notes, and snippets.

View plasticine's full-sized avatar
🐧
Hello? Is this thing on?

Justin Morris plasticine

🐧
Hello? Is this thing on?
View GitHub Profile
// Tumblr bookmarklet script
javascript:
var%20d = document,
w = window,
e = w.getSelection,
k = d.getSelection,
x = d.selection,
s = (e?e():(k)?k():(x?x.createRange().text:0)),
f = 'http://www.tumblr.com/share',
ServerPath /repo/
RewriteEngine On
RewriteRule ^(/repo/.*) /path/$1
$(document).ready(function() {
jQuery.fn.commentform = function(){
return this.each(function(){
$("#slider").slideToggle("slow").toggleClass('open');
$(this).toggleClass("active");
if($(this).attr('id')){
var replyData = /reply-([\d]{1,})-([\w]{1,})/.exec($(this).attr('id'));
var userSelection = getSelectedText();
if(userSelection){
@plasticine
plasticine / gist:44151
Created January 7, 2009 02:42
jQuery Fairydust to help style form inputs...
$(document).ready(function() {
$('input:file').each(function(index) {
$(this).wrap('<label class="file-input"></label>').wrap('<div class="file-wrapper" style="position:relative;"></div>');
$('.file-wrapper').prepend('<span class="file-input-title">Upload file</span>').append('<span class="file-input-path">...</span>');
$(this).css({'opacity':'0.0', 'position':'absolute', 'top':'0', 'left':'0'});
$(this).change(function(){
var value = $(this).val();
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
@user_passes_test(lambda u: u.has_perm('foo.bar'), login_url=settings.LOGIN_URL)
def widgetize(request):
""" Clever, clever, clever... """
pass
<?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>Label</key>
<string>nginx</string>
<key>Program</key>
<string>/usr/local/sbin/nginx</string>
<key>KeepAlive</key>
<true/>
@plasticine
plasticine / SCSS Sprite based nav.scss
Created May 9, 2011 01:43
Generates all the required classes, hover states and image offsets for sprite-based navigation.
@function sprite-ify($items, $height, $img, $offset:0){
display:block;
height:$height;
text-indent:-9999px;
background-color:transparent;
background-image:url($img);
@for $index from 1 through length($items) {
$item: nth($items, $index);
@if $index > 1 { $offset: $offset - nth(nth($items, $index - 1), 2); }
&.#{nth($item, 1)} {
<li>
<% editors = Editor.all() %>
<select class="<%= (editors.map(&:id).include?(params[:id].to_i)) ? 'active' : '' %>">
<option value="">filter</option>
<option value="everyone">everyone</option>
<% editors.sort_by(&:friendly_name).each do |editor| %>
<option value="<%= editor.id %>" <%= (params[:id] == "#{editor.id}") ? 'selected' : '' %>><%= editor.friendly_name %></option>
<% end %>
</select>
</li>
[2011-07-30 11:59:39,749: WARNING/MainProcess] [email protected] has started.
[2011-07-30 11:59:39,777: WARNING/MainProcess] Traceback (most recent call last):
[2011-07-30 11:59:39,777: WARNING/MainProcess] File "/Users/justin/Sites/_virtualenvs/cobracommander/bin/django-admin.py", line 5, in <module>
[2011-07-30 11:59:39,777: WARNING/MainProcess] management.execute_from_command_line()
[2011-07-30 11:59:39,778: WARNING/MainProcess] File "/Users/justin/Sites/_virtualenvs/cobracommander/lib/python2.7/site-packages/django/core/management/__init__.py", line 429, in execute_from_command_line
[2011-07-30 11:59:39,778: WARNING/MainProcess] utility.execute()
[2011-07-30 11:59:39,778: WARNING/MainProcess] File "/Users/justin/Sites/_virtualenvs/cobracommander/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
[2011-07-30 11:59:39,778: WARNING/MainProcess] self.fetch_command(subcommand).run_from_argv(self.argv)
[2011-07-30 11:59:39,779: WARNING/MainProcess] File "/Users/justin/Sit