Skip to content

Instantly share code, notes, and snippets.

View zachleat's full-sized avatar
🚨
GitHub Drop ICE

Zach Leatherman zachleat

🚨
GitHub Drop ICE
View GitHub Profile
@zachleat
zachleat / anchorsaway.js
Last active December 22, 2015 00:08
AnchorsAway.js
/*! AnchorsAway - v0.1.0 - 2013-08-30
* Copyright (c) 2013 Zach Leatherman
* See also @zachleat http://www.zachleat.com
* MIT License
*
* A bookmarklet to show all of the available anchor links on a page.
* Originally developed to allow easier direct linking to specific paragraphs
* on Wikipedia.
*
* Demo: http://jsbin.com/UNiWiCO/1
@zachleat
zachleat / gist:7015856
Last active December 25, 2015 17:49
Sublime Text 2 User Settings
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"caret_style": "wide",
"detect_indentation": true,
"detect_slow_plugins": false,
"draw_white_space": "all",
"fade_fold_buttons": true,
"find_selected_text": true,
"font_face": "Consolas",
@zachleat
zachleat / gist:7015883
Created October 16, 2013 22:15
Sublime Text 2 User Key Bindings
[
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["ctrl+super+t"], "command": "swap_case" },
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
{
"keys": ["super+shift+enter"],
"command": "run_macro_file", "args": {"file": "Packages/User/ConvertSpacesToTabs.sublime-macro"}
},
@zachleat
zachleat / gist:9643862
Last active August 29, 2015 13:57
Requirements/Notes on JavaScript Form Validation

Two classes of validators:

  • Required (empty/non-empty) validation
  • Format validation (phone number, zip/postal code, etc)

Don’t show both a required error and a format error at the same time. In other words, format validation errors are NOT shown for empty fields (doesn’t matter if they are required or not).

Pseudocode for an isValid method:

@zachleat
zachleat / gist:50578607918115fd4d89
Last active September 16, 2016 11:06
NebraskaJS Intro to Open Source
Guides:
http://pragtob.wordpress.com/2014/01/13/how-to-get-started-with-contributing-to-open-source/
http://movethewebforward.org/
http://www.smashingmagazine.com/2011/11/30/the-smashing-guide-to-moving-the-web-forward-community/
http://nshipster.com/stewardship/
https://speakerdeck.com/brycekahle/helping-open-source-software
for Designers:
@zachleat
zachleat / gist:d2f44e29c77ce2adb8c4
Created August 19, 2014 16:03
Device Lab Names
Mobile, Alabama
Alexander Graham Mobile
Big Shelf of Phones
Shelfie
Wall of Shame
Clown Town
phoneucopia
The Mobile Context
Dante’s Inphono
Mo’problems.
@zachleat
zachleat / zachleat.gifwit
Last active August 29, 2015 14:06
My personal gifwit Library
{
"images" : [
{
"url" : "https:\/\/dl.dropboxusercontent.com\/u\/361291\/gifs\/confusion.gif",
"keywords" : "confusion"
},
{
"url" : "https:\/\/dl.dropboxusercontent.com\/u\/361291\/gifs\/congratulations!!!.gif",
"keywords" : "congratulations!!!"
},
@zachleat
zachleat / gist:68611e730f6c2280e8c9
Last active August 29, 2015 14:07
WOFF2 Feature Test
var supportsWoff2 = (function( win ){
if( !( "FontFace" in win ) ) {
return false;
}
var f = new win.FontFace( "woff2test", 'url( "data:font/woff2;base64," ) format( "woff2" )' );
f.load();
return f.status == 'loading';
})( this );
@zachleat
zachleat / gist:fbc60c7ff5349a6ab81e
Last active August 19, 2018 12:01
Differences between jQuery().find and querySelectorAll

Scope

$.fn.find scopes selectors to the context element by default and querySelectorAll requires using the :scope pseudoelement selector.

// 0 results
jQuery("body").find("html div").length;

// Lot of results
document.body.querySelectorAll( "html div" ).length;
@zachleat
zachleat / gist:2f6b252fc30bca7cb753
Last active August 29, 2015 14:10
Are database records a Hacker’s Handbook?

Read about the court case in question:

http://www.omaha.com/news/crime/a-key-question-in-digital-data-legal-challenge-public-records/article_4690a9b4-7180-5551-950a-c5d8f649b2f3.html

Thoughts

  • Are Open Source Projects insecure because they publish their table structure? These 1.5M results on GitHub suggest software engineers think otherwise.
  • But what about SQL Injection? Are those attacks are easier knowing the database table structure. Not really, no. Finding out whether a server can be exploited using SQL Injection is done without knowledge of the database structure. In fact, injections like ' or '1'='1 exploit basic boolean expressions, not table structure. Once you know the server is exploitable, it’s easy to fetch the table structure assuming it’s not a Blind injection.
  • Is it easier to steal books fro