Skip to content

Instantly share code, notes, and snippets.

@minitech
minitech / dont-pass-undefined.md
Last active December 10, 2015 02:58
Why you shouldn’t pass an `undefined` to your wrapper.

A common pattern is to make sure that undefined is actually what it says it is, using some kind of wrapper function:

(function(undefined) {
    // undefined will be undefined now, even if some idiot overwrote it.
})();

Why you shouldn’t do that:

@minitech
minitech / web-checklist.md
Last active January 4, 2020 11:59
minitech’s Web Checklist

minitech’s Web Checklist

Here are some guidelines that will make me actually like your amazing new web application!

  1. Make sure encoding is handled properly every step of the way. If comes out as ’, you’ve got a problem on your hands. 😊

  2. Make it accessible. Turn off images, JavaScript, and CSS. If your website is still legible and usable (it’s okay if it’s just barely usable, or not particularly interactive) then you are already in the top 0.01%.

  3. Check your grammar. One of the fastest ways to lose respect in a blog post (or worse — in body copy) is to make basic orthographical or grammatical mistakes. These include, but are not limited to:

  • Missing apostrophes — [Bitbucket even did that][bitbucket-apostrophe-catastrophe].
@minitech
minitech / price-format-modified.js
Created November 25, 2012 18:20
Price Format Modification
/*
* Note: This was a bugfix for http://stackoverflow.com/a/9454335/707111.
* I submitted a pull request (https://github.com/flaviosilveira/Jquery-Price-Format/pull/5),
* which was ignored. I'm leaving this here so that my answer isn't entirely useless,
* but the project has been updated since.
* Price Format jQuery Plugin
* Created By Eduardo Cuducos cuducos [at] gmail [dot] com
* Currently maintained by Flavio Silveira flavio [at] gmail [dot] com
@minitech
minitech / dabblet.css
Created November 7, 2012 15:49
Absolute positioning for full height
/**
* Absolute positioning for full height
*/
body {
margin: 0;
}
#container {
background-color: #07f;
@minitech
minitech / dabblet.css
Created November 7, 2012 15:29
Using a box-shadow to mimic a gradient
/**
* Using a box-shadow to mimic a gradient
*/
#item {
background-color: #07f;
border-radius: 0.2em;
box-shadow: inset 0 -1em 1em -0.5em rgba(0, 0, 0, 0.7);
color: white;
display: inline-block;
@minitech
minitech / gist:3980564
Created October 30, 2012 14:37
A shutdown with confirmation for Windows 8 pinning
If MsgBox("Are you sure you want to shut down?", vbExclamation Or vbYesNo Or vbDefaultButton2, "Shut down") = vbYes Then
Dim wsh : Set wsh = CreateObject("WScript.Shell")
wsh.Run "shutdown /s /t 0"
End If
@minitech
minitech / dabblet.css
Created October 8, 2012 17:21
✎'s "Under Construction" page prototype
/**
* ✎'s "Under Construction" page prototype
*/
/* Background
-------------------------------*/
body {
background-color: #ccc;
}
@minitech
minitech / file_parts.rb
Created October 4, 2012 04:23
Getting a file's name and extension*s*
# https://twitter.com/garybernhardt/status/253708758964903936
def file_parts(filename)
parts = filename.split '.'
last_spaces =
parts.rindex do |part|
part.include? ' '
end
[parts[0..last_spaces].join('.'), parts[last_spaces+1..-1]]
@minitech
minitech / dabblet.css
Created September 18, 2012 02:35
Fixed elements that have a right margin relative to a content element
/**
* Fixed elements that have a right margin relative to a content element
* http://stackoverflow.com/q/12469476/707111
*/
html, body {
height: 100%;
margin: 0;
}