Skip to content

Instantly share code, notes, and snippets.

def string2png( string, output )
image = Magick::Image.new 1,string.length
for i in 0 .. string.length
color = '#%02X0000' % string[i]
pixel = Magick::Pixel.from_color color
image.pixel_color 0, i, pixel
end
image.compression = ZipCompression
image.write("png8:"+ output)
def string2pngs( string, output )
puts "original string length #{string.length}"
limit = 8192 #8192 # IE9 max for getImageData
images_count = (string.length * 1.0 / limit ).ceil
files = []
for i in 0 ... images_count
filename = output.split('.')
var f,proxy,d=document;
var addCss = function(s) {
var c = d.createElement('style');
c.type = 'text/css';
if (c.styleSheet)
c.styleSheet.cssText = s;
else
c.appendChild(d.createTextNode(s));
d.getElementsByTagName('HEAD')[0].appendChild(c);
@sr3d
sr3d / gfm.rb
Created August 21, 2010 21:01 — forked from mojombo/gfm.rb
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end
@sr3d
sr3d / x1.js
Created August 22, 2010 22:20
var x1 = function( z, m ) { // image url, callback
var o = new Image();
o.onload = function() {
var s = "",
c = d.createElement("canvas"),
t = c.getContext("2d"),
w = o.width,
h = o.height;
c.width = c.style.width = w;
c.height = c.style.height = h;
# lib/paypal.rb
require 'net/http'
module Paypal
# paypal_cert: the content of the paypal certificate
# business_key: content of the private key
# business_cert: content of the public cert
# business_certid: the ID of the public cert, provided by PayPal on the web
// ==UserScript==
// @name Paypal Sandbox autorefresh
// @description Automatically refresh paypal sandbox pages
// @include https://paypalmanager.sandbox.paypal.com/*
// @include https://developer.paypal.com/*
// @include https://sandbox.paypal.com/*
// @include https://www.sandbox.paypal.com/*
// @include http://developer.paypal.com/*
// @author Alex Le (http://marrily.com)
// ==/UserScript==
server {
listen 80;
server_name marrily.com;
root /var/www/current/public;
passenger_enabled on;
rails_env production;
gzip on;
gzip_http_version 1.1;
gzip_vary on;
openssl genrsa -out private.key 2048
Generating RSA private key, 2048 bit long modulus
..............................+++
.+++
e is 65537 (0x10001)
$ openssl req -new -key private.key -out marrily.com.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US