Skip to content

Instantly share code, notes, and snippets.

@madevelopers
madevelopers / gist:a95b4ce6512fb6f82ae7
Last active August 29, 2015 14:23
How to declare variables in Java #java #flashcard
String firstName;
String lastName;
int hour, minute;
@madevelopers
madevelopers / gist:9583aa5db4b73d833e30
Last active August 29, 2015 14:23
How to print to the console in Java #java #flashcard
class Hello {
    public static void main(String[] args) {
        System.out.print("Hello ");
        System.out.println(" World!");  // Adds a newline character at the end
        // > Hello World!
    }
}
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
The regex patterns in this gist are intended to match any URLs,
including "mailto:foo@example.com", "x-whatever://foo", etc. For a
pattern that attempts only to match web URLs (http, https), see:
https://gist.github.com/gruber/8891611
# Single-line version of pattern:
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))
/**
* iBooks JS Framework
* Compatibility: iBooks 1.5+
* Copyright © 2009-2011 Apple Inc. All rights reserved.
*
**/
/**
* @name iBooks
* @namespace
@madevelopers
madevelopers / indesign epub checklist.txt
Created February 3, 2015 05:41
epub: Checklist for InDesign to epub compatibility
Before layouting:
* Rename images. Image filenames should not include spaces and foriegn characters.
* Always use space before on paragraph styles and must be equivalent to css em.
Preping for epub:
* Remove all unecessary forced linebreak.
@madevelopers
madevelopers / readzip.go
Created January 29, 2015 09:36
golang: Read zip file
package main
import (
"archive/zip"
"fmt"
"io/ioutil"
)
type myCloser interface {
Close() error
@madevelopers
madevelopers / GetImageDimension.go
Created January 29, 2015 07:56
golang: Get image dimension
package main
import (
"fmt"
"image"
_ "image/gif"
_ "image/jpeg"
_ "image/png"
"io"
"os"
@madevelopers
madevelopers / epub: epubpack
Created April 23, 2014 06:21
A simple shell script for packaging epubs
#!/usr/bin/env bash
#
# A simple shell script for packaging epubs.
#
epub_dir="${1}" # required
epub_filename="${2}" # optional
@madevelopers
madevelopers / .editorconfig
Last active June 29, 2017 07:26
My preffered editorconfig settings
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true