Skip to content

Instantly share code, notes, and snippets.

@merlinmann
merlinmann / wisdom.md
Last active April 17, 2024 21:52
Merlin's Wisdom Project (Draft)

Merlin's Wisdom Project

Or: “Everybody likes being given a glass of water.”

By Merlin Mann.

It's only advice for you because it had to be advice for me.

@dariusk
dariusk / 433.js
Created November 19, 2015 03:52
John Cage's 4'33" in the Web Audio API.
// John Cage's 4'33" with the Web Audio API
function makeSilence(e) {
var buflen = e.outputBuffer.length;
var dataL = e.outputBuffer.getChannelData(0);
var dataR = e.outputBuffer.getChannelData(1);
dataL.fill(0);
dataR.fill(0);
}
function InitAudio() {
@moonmilk
moonmilk / dotcollection.json
Created May 31, 2015 23:20
graphics in tracery
{
"origin": [
"<svg width=\"400\" height=\"200\">#pattern#</svg>"
],
"circlecolor": [
"pink",
"cyan",
"yellow",
"orange",
"gray",
@caseywatts
caseywatts / bookmarkleting.md
Last active May 5, 2024 10:18
Making Bookmarklets

This is one chapter of my "Chrome Extension Workshops" tutorial, see the rest here: https://gist.github.com/caseywatts/8eec8ff974dee9f3b247

Unrelated update: my book is out! Debugging Your Brain is an applied psychology / self-help book

Making Bookmarklets

I'm feeling very clever. I've got this sweet line of javascript that replaces "cloud" with "butt". My mom would LOVE this, but she doesn't computer very well. I'm afraid to show her the Developer Console and have her type/paste this in. But she IS pretty good at bookmarks, she knows just how to click those!

A bookmark normally takes you to a new web page. A bookmarklet is a bookmark that runs javascript on the current page instead of taking you to a new page. To declare that it is a bookmarklet, the "location" it points to starts with javascript:.

@videlais
videlais / noclickjQueryTwine.js
Last active January 17, 2020 21:17
No-click Twine (1.4) using jQuery
// First, create a reference to the Wikifier.createInternalLink function.
// (Internally, this is what Twine uses to connect passages together.
// It is the last step in parsing double-bracked content into links.)
var oldCreateInternalLink = Wikifier.createInternalLink;
// Then, create a new function that mimics its functionality.
Wikifier.createInternalLink = function(place, title) {
// By calling the old function, it returns
// the DOM element (the link) it was about to
@dariusk
dariusk / README.md
Last active August 17, 2020 23:48
This Twine macro lets you make the screen shake! Tested in Chrome and Firefox. Should work in Opera and IE 10+. Uses CSS3 animations. #TwineHacks

This Twine macro lets you make the screen shake! Tested in Chrome and Firefox. Should work in Opera and IE 10+. Uses CSS3 animations, taken from this CSS Reset tutorial.

See a demo in action here.

How to set it up

IMPORTANT NOTE: Due to a bug in Twine 1.3.5, macros do not work on the Start passage. If you want to use this code (or any other macro) on your starting passage, you should put your start passage in a new passage called "ActualStart" and then put the following code in the Start passage:

<<display ActualStart>>
@dariusk
dariusk / README.md
Last active June 4, 2020 02:29
This lets you use the Wordnik API in Twine to get random nouns and adjectives. I didn't include verbs because conjugation sucks and I'm lazy.#TwineHacks

This Twine macro lets you use the Wordnik API to get random nouns and adjectives for your story.

See a demo in action here.

How to set it up

  • IMPORTANT FIRST STEP: you must have a Wordnik API key to use this! If you don't already have one, go here to register for an API key. If you do already have one, move on to the next step!
  • Paste the contents of the WordnikRandomWords.js file below into a new passage. Call the passage whatever you want, and add the tag "script" to it.
  • Modify the first line of the passage you just created so that instead of "var API_KEY = 'xxxxxxx'" you replace the x's with your actual API key you got from Wordnik.
@dariusk
dariusk / README.md
Last active December 11, 2015 18:39
Modifies the Jonah theme so that it can be used as a presentation (like if you want to display it on a projector).

Twine Presentation (Projector) Mode

Modifies the Jonah theme so that it can be used as a presentation (like if you want to display it on a projector). In addition to making the text bigger and playing with the content width, this also maps the left arrow key to move backwards in your presentation. (Forward arrow doesn't make sense because you might have a branching presentation.)

Installation instructions

  • Make sure you're using the Jonah theme (Story -> Story Format -> Jonah)
  • Place the contents of "script.js" in a passage tagged "script"
  • Place the contents of "stylesheet.css" in a passage tagged "stylesheet"
@Daniel15
Daniel15 / 1_Twitter autoresponder bot.md
Last active December 6, 2021 20:37
Twitter autoresponder bot

Twitter autoresponder bot

By Daniel15 (dan.cx) This is a very simple Twitter autoresponder bot. It requires PECL OAuth extension to be installed (run "pecl install oauth", or if on Windows, grab php-oauth.dll. If using cPanel you can install it via WHM). The authentication is designed for command-line usage, it won't work too well via a web browser. You'll have to sign up for an application on Twitter's site to get the consumer key and secret.

Could be modified to be more advanced (match regular expressions to answer questions, etc.)

Questions? See my blog post - http://dan.cx/blog/2011/06/twitter-autoreply-bot-dbznappa

Modified 2013-06-13 - Twitter API 1.0 discontinued, modified to use Twitter API 1.1