Skip to content

Instantly share code, notes, and snippets.

// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@dellsystem
dellsystem / process.py
Created May 12, 2011 16:56
Converting and resizing images (pyramidal tiff)
#!/usr/bin/env python
import sys, os
from PIL import Image
import math
# Does all the image processing
# Just give it a directory of images in .tif/.tiff format that are not processed
# It will find the lowest max zoom, and resize all larger images to that zoom level
# Then it will convert all the images to pyramidal tiff format, and put them into a subdirectory
# Then it will copy everything from that subdirectory to /mnt/images/dir
@dellsystem
dellsystem / gist:969077
Created May 12, 2011 17:58
VIPS tile processing

Look at the largest dimension (width or height)

  • 1 zoom level: 1 to 256
  • 2 zoom levels: 257 to 513
  • 3 zoom levels: 514 to 1027
  • 4 zoom levels: 1028 to 2055
  • 5 zoom levels: 2056 to 4111
  • 6 zoom levels: 4112 to 8223
  • ...
  • n zoom levels: (2^(n-2)) * (256 + 1) to (2^(n-1) * (256 + 1)) - 1 (except when n = 1, in which case the lower bound is just 1)
@p01
p01 / LICENSE.txt
Last active May 23, 2024 13:46 — forked from 140bytes/LICENSE.txt
Sudoku Solver in 140bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri - http://www.p01.org/releases/
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@sontek
sontek / snowjob.py
Created December 22, 2011 04:24
Make your terminal snow with python
#!/usr/bin/env python
import os
import random
import time
import platform
snowflakes = {}
try:
# Windows Support
// ==UserScript==
// @name WebCT Multiple sessions and Never expiring mymcgill sessions
// @namespace fuck webct
// @description ^
// @include https://mycourses.mcgill.ca/webct/cobaltMainFrame.dowebct?*
// @include http://mycourses.mcgill.ca/webct/cobaltMainFrame.dowebct?*
// @include https://mymcgill.mcgill.ca/portal/page/portal*
// @include http://mymcgill.mcgill.ca/portal/page/portal*
// ==/UserScript==
.data
list1: .word 4,6,3,7,9,34,9,1,2,2,3,4,4,4,6
buf1: .space 60
list2: .word 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
buf2: .space 60
list3: .word -1,43,5,6,-7,2,3,4,-3,4,5,3,3,2,3
buf3: .space 60
test1: .asciiz "\nTesting for list1 - random list\n------------------------------\n"
test2: .asciiz "\nTesting for list2 - sorted list\n------------------------------\n"
test3: .asciiz "\nTesting for list3 - negative numbers\n------------------------------\n"
@jpgg
jpgg / evaluateTest.asm
Created March 25, 2012 23:36
Programs to test 273 A3 assignment
# To use, first add your evaluateP and power functions to the bottom of the
# file where specified.
# Next, edit the values of POLYORDER, COEFFICIENTS, and ARGX to whatever you
# want. Test what the polynomial will return with something like wolfram alpha
# and then assemble it in Mars and run it. The program just returns the final
# value.
.data
ZERO: .float 0.0
ONE: .float 1.0
@mbostock
mbostock / .block
Last active October 19, 2021 16:36 — forked from mbostock/.block
click-to-zoom via transform
license: gpl-3.0