Skip to content

Instantly share code, notes, and snippets.

View jdlrobson's full-sized avatar

Jon Robson jdlrobson

View GitHub Profile
from tiddlyweb import control
from tiddlywebplugins.utils import get_store
from tiddlyweb.store import Store, NoBagError,NoTiddlerError
from tiddlyweb.model.bag import Bag
from tiddlyweb.model.recipe import Recipe
from tiddlyweb.model.tiddler import Tiddler
def mytest(environ, start_response):
start_response('200 OK', [
('Content-Type', 'text/html; charset=utf-8')
tags: systemConfig
/***
|Name|PublishCommand|
|Version|0.21|
|Author|BenGillies|
|Description|Publish a tiddler by moving or copying it from one bag to another|
!Usage
Add {{{publishtiddler}}} to your ToolbarCommands tiddler.
store.addNotification("StyleSheetTiddlySpace", refreshStyles);
var stylesheetTS = store.namedNotifications[store.namedNotifications.length - 1];
var newNotifications = [stylesheetTS].concat(store.namedNotifications.slice(0,store.namedNotifications.length-1));
store.namedNotifications = newNotifications;
jQuery.ajaxSetup({
beforeSend: function() {
console.log("in global ajax beforeSend");
}
});
console.log("Request one");
var ajax = ajaxReq({
url: "/",
beforeSend: function() {
@jdlrobson
jdlrobson / simulate_delete
Created June 7, 2011 08:25
Takes a textarea/input and deletes the text bit by bit
function clear(el) {
var interval = 300;
var charactersToRemove = 1;
var id = setInterval(function(ev) {
var x = $(el).val();
if(!x) {
clearInterval(id);
} else {
var pos = x.length - charactersToRemove;
x = x.substr(0, pos);
@jdlrobson
jdlrobson / packager
Created June 10, 2011 10:51
This python script collects plugins specified by name in tiddlyspace spaces, minifies them and puts them to the DESTINATION space. A user and pass are provided for authorisation to save to DESTINATION
import httplib2, urllib, datetime, os
from datetime import datetime as d
import simplejson
USER = "<user>"
PASS = "<pass>"
DESTINATION = "package-i"
PLUGINS = [{ "title": "TiddlyPoller", "space": "poller" }, { "title": "StaticMapPlugin", "space": "staticmaps"}, { "title": "ExtraFiltersPlugin", "space": "filters" },
{ "title": "EditTemplateFieldsPlugin", "space": "first-class-fields" }, { "title": "MySearchPlugin", "space": "mysearch" }, { "title": "ReverseLookupFix", "space": "mysearch" },
@jdlrobson
jdlrobson / fetchTiddlerAjax
Created June 23, 2011 13:12
overriding fetchTiddler
function TiddlyWiki()
{
var tiddlers = {}; // Hashmap by name of tiddlers
this.tiddlersUpdated = false;
this.namedNotifications = []; // Array of {name:,notify:} of notification functions
this.notificationLevel = 0;
this.slices = {}; // map tiddlerName->(map sliceName->sliceValue). Lazy.
this.clear = function() {
tiddlers = {};
this.setDirty(false);
@jdlrobson
jdlrobson / reflector weirdness
Created June 28, 2011 14:38
reflector weirdness - a tiddlywiki as uploaded by the reflector
<HEAD><TITLE>My TiddlyWiki - a reusable non-linear personal web notebook</TITLE>
<SCRIPT id=versionArea type=text/javascript>
//<![CDATA[
var version = {title: "TiddlyWiki", major: 2, minor: 6, revision: 2, date: new Date("Jan 6, 2011"), extensions: {}};
//]]>
</SCRIPT>
<META http-equiv=Content-Type content=text/html;charset=utf-8>
<META content="&#10;TiddlyWiki created by Jeremy Ruston, (jeremy [at] osmosoft [dot] com)&#10;&#10;Copyright (c) Jeremy Ruston 2004-2007&#10;Copyright (c) UnaMesa Association 2007-2011&#10;&#10;Redistribution and use in source and binary forms, with or without modification,&#10;are permitted provided that the following conditions are met:&#10;&#10;Redistributions of source code must retain the above copyright notice, this&#10;list of conditions and the following disclaimer.&#10;&#10;Redistributions in binary form must reproduce the above copyright notice, this&#10;list of conditions and the following disclaimer in the documentation and/or other&#10;materials provided with the dist
@jdlrobson
jdlrobson / resizable-textarea.js
Created July 14, 2011 16:42
make a textarea resize as you type into it!
// BSD License - written by jon robson (http://jonrobson.me.uk)
// see http://jon.tiddlyspace.com/jquery autoresize
function autoResize(el) {
var resize = function(ev) {
el = ev.target;
var div = $('<div />').addClass($(ev.target).attr("class")).hide().
css({ "word-wrap": "break-word" }).appendTo($(el).parent())[0];
var value = $(el).val() || "";
var lines = value.split("\n");
for(var i = 0; i < lines.length; i++) {
== Welcome to Rails
Rails is a web-application framework that includes everything needed to create
database-backed web applications according to the Model-View-Control pattern.
This pattern splits the view (also called the presentation) into "dumb"
templates that are primarily responsible for inserting pre-built data in between
HTML tags. The model contains the "smart" domain objects (such as Account,
Product, Person, Post) that holds all the business logic and knows how to
persist themselves to a database. The controller handles the incoming requests