Skip to content

Instantly share code, notes, and snippets.

@panzi
panzi / s3m-form.txt
Created Jun 24, 2011
unicode version of s3m-form.txt
View s3m-form.txt
Source: http://www.textfiles.com/music/FORMATS/s3m-form.txt
Scream Tracker 3.01 BETA File Formats And Mixing Info
=====================================================
This document finally containts the OFFICIAL information on s3m format and
much more. There might be some errors though I've even checked this a few
times, so if something seems weird, don't just blindly believe it but think
first if it could be just a typo or something.
@panzi
panzi / input-demo.html
Created Oct 4, 2011
Show a "title" for empty text inputs/textareas.
View input-demo.html
<!DOCTYPE html>
<html>
<head>
<title>Input Demo</title>
<!--
This is an example on how to create a text input/textarea with a
nice description on what to enter in case nothing is entered.
It uses Prototype for DOM navigation and updating an elements
class name, but it should be easy to port to any other JavaScript
@panzi
panzi / absurl.js
Created Feb 18, 2012
Build an absolute url from an relative url and an absolute base url.
View absurl.js
/**
* Build an absolute url using an base url.
* The provided base url has to be a valid absolute url. It will not be validated!
* If no base url is given the document location is used.
* Schemes that behave other than http might not work.
* It tries to support file:-urls, but might fail in some cases.
* email:-urls aren't supported at all (don't make sense anyway).
*
* NOTE: Internet Explorer does not support the baseURI property, but it does
* support the base tag, which results in wrong url. You might want to
@panzi
panzi / escapeXml.js
Created Feb 18, 2012 — forked from atesgoral/escapeXml.js
Escape XML in JavaScript.
View escapeXml.js
var XML_CHAR_MAP = {
'<': '&lt;',
'>': '&gt;',
'&': '&amp;',
'"': '&quot;',
"'": '&apos;'
};
function escapeXml (s) {
return s.replace(/[<>&"']/g, function (ch) {
View capybara-helpers.rb
def screenshot
require 'capybara/util/save_and_open_page'
now = Time.now
p = "/#{now.strftime('%Y-%m-%d-%H-%M-%S')}-#{rand}"
Capybara.save_page body, "#{p}.html"
path = Rails.root.join("#{Capybara.save_and_open_page_path}#{p}.png").to_s
page.driver.render path
Launchy.open path
end
@panzi
panzi / firefox_opera_ie.js
Created Nov 1, 2012
Cross site HTTP Auth via JavaScript
View firefox_opera_ie.js
_loginBrowser: function () {
// HTTP Auth hack for Firefox, Opera and IE.
this._loginScript("http://stream.magnatune.com");
},
_loginScript: function (origin, options) {
var finished = false;
var onerror = function (event) {
if (finished) return;
if (event.originalEvent.target === script) {
finished = true;
@panzi
panzi / 00_head.html
Created Nov 1, 2012
Save/download data generated in JavaScript (1)
View 00_head.html
<!DOCTYPE html>
<html>
<head>
<title>Save Generated Data</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1"/>
<script type="text/javascript">
// <![CDATA[
@panzi
panzi / 10_object_url.js
Created Nov 1, 2012
Save/download data generated in JavaScript (2)
View 10_object_url.js
if (BrowserSupportedMimeTypes[mimetype.split(";")[0]] === true) {
  mimetype = "application/octet-stream";
 }
 
 blob = builder.getBlob(mimetype);
 url = URL.createObjectURL(blob);
 window.open(url, '_blank', '');
}
@panzi
panzi / share.html
Last active Oct 12, 2015
Social Share Privacy for Blogger
View share.html
<link rel="stylesheet" type="text/css" href="http://panzi.github.io/SocialSharePrivacy/stylesheets/jquery.socialshareprivacy.min.css" />
<style type="text/css">
#share {
position: absolute;
top: 110px;
left: -120px;
opacity: 0.3;
-webkit-transition: opacity 0.5s linear;
-moz-transition: opacity 0.5s linear;
-ms-transition: opacity 0.5s linear;
@panzi
panzi / dataurl.py
Created Nov 2, 2012
Python 3 data url handler
View dataurl.py
import binascii
import urllib.request
import urllib.parse
import email.message
import io
__all__ = ['parse_data_url','DataResponse','DataHandler']
def parse_data_url(url):
scheme, data = url.split(":",1)
You can’t perform that action at this time.