Skip to content

Instantly share code, notes, and snippets.

@fchasen
fchasen / jump.markdown
Created October 27, 2010 07:10
Proposal for $ Fragments

#Proposal for $ Fragments

##Example:

If we have:

<a name = "jump1">Jump To Me</a>

According to the W3 spec: >"Having defined the anchor, we may link to it from the same or another document. URIs that designate anchors contain a "#" character followed by the anchor name"

@fchasen
fchasen / hit1.js
Created November 2, 2012 07:26
hit1
function Stage(el) {
this.el = document.getElementById(el);
this.position();
this.listeners();
return this;
}
Stage.prototype = {
position: function(){
/*
Fred Chasen
Pulse Light
*/
// Connect to Pin 11, for analog
int led = 11;
int minamount = 5;
int x = minamount;
@fchasen
fchasen / _.md
Created February 22, 2013 00:53
INFO247 / Lab 5 / #3
@fchasen
fchasen / allids.js
Last active December 20, 2015 13:48
Get all nodes with Ids
//-- Get all nodes with Ids
this.$ = {};
Array.prototype.map.call(document.querySelectorAll('[id]'),
function(node){ this.$[node.id] = node; }.bind(this));
@fchasen
fchasen / request
Created August 9, 2013 23:25
request
function request(url, response, failure) {
var request = new XMLHttpRequest();
var failed = failure || function(){};
request.open("GET", url, true);
request.onreadystatechange = function(e) {
if(request.readyState == 4) {
if(request.status == 200) {
@fchasen
fchasen / request_basicauth.js
Created January 8, 2014 18:31
Loading this script after after epub.js and it should overwrite the EPUBJS.core.request method. Change the login credentials in the file to your servers. USERNAME = 'abc' PASSWORD = 'xyz'
USERNAME = 'abc'
PASSWORD = 'xyz'
EPUBJS.core.request = function(url, type) {
var supportsURL = window.URL;
var BLOB_RESPONSE = supportsURL ? "blob" : "arraybuffer";
var deferred = new RSVP.defer();
var xhr = new XMLHttpRequest();
@fchasen
fchasen / xhtml wrapper
Created March 11, 2015 03:04
xhtml wrapper
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title>YOUR TITLE</title>
</head>
<body>
YOUR CONTENT
</body>
</html>
EPUBJS.Hooks.register("beforeChapterDisplay").overrideStyles = function(callback, renderer){
EPUBJS.core.addCss("overrides.css", false, renderer.render.document.head);
callback();
}
@fchasen
fchasen / xmlcom.apple.ibooks.display-options.xml
Created April 8, 2015 18:15
com.apple.ibooks.display-options.xml
<display_options>
<platform name="*"> <!-- all devices -->
<option name="fixed-layout">true</option> <!-- fixes the layout -->
<option name="specified-fonts">true</option> <!-- set to "true" when embedding fonts -->
<option name="open-to-spread">true</option> <!-- single page or full spread on open -->
<!--<option name="orientation-lock">landscape-only</option> "landscape-only" or "portrait-only" or leave this line commented -->
<option name="interactive">true</option> <!-- set to "true" when using javascript or canvas -->
</platform>
</display_options>