Skip to content

Instantly share code, notes, and snippets.

View MidnightLightning's full-sized avatar

Brooks Boyd MidnightLightning

View GitHub Profile
@MidnightLightning
MidnightLightning / README.md
Last active September 26, 2015 00:38
Javascript popups

The "target" attribute in links is now only used for pages using framesets (reference), so how do you pop up a new browser window for links you want to have people navigate to without leaving your page?

Using the current W3 standard for anchor tags anchor tags can be given a rel attribute that describes what relation the linked-to page has to this current page. It also provides a standard list of available relationships. Many other groups added to this list and there are many widely-used values for the rel tag, including "external".

With this method, give links to be made popups a rel attribute of "external", and include the following file in the head of the document.

@MidnightLightning
MidnightLightning / nest.php
Last active September 26, 2015 00:37
Nested Substrings
<?php
/**
* Return a substring, honoring nested strings
*
* Find from "start" to "end" in a given "haystack" string,
* but if a second "start" is encountered before the first "end",
* skip over the nested repetition and return all the way up to the proper "end" for the outer "start"
*
* @author Brooks Boyd <[email protected]>
@MidnightLightning
MidnightLightning / index.html
Created August 13, 2010 17:39
A local file to generate complex passwords based on a more user-friendly seed
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Password-generating sidebar</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="content-style-type" content="text/css" />
<style type="text/css">
body { font-size:10pt; }