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 / 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: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: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
@zachleat
zachleat / gist:057d3050858e195544a0
Created December 20, 2014 03:54
Compass linear-gradient output
background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuMCIgeTE9IjAuNSIgeDI9IjEuMCIgeTI9IjAuNSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Y4ZTAwMCIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2Y0YmEwMCIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
background: -webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0%, #f8e000), color-stop(100%, #f4ba00));
background: -moz-linear-gradient(left, #f8e000, #f4ba00);
background: -webkit-linear-gradient(left, #f8e000, #f4ba00);
background: linear-gradient(to right, #f8e000, #f4ba00);
# Bash script to convert a GIF to a video
# Only works with const framerate gifs
# Requires ffmpeg and imagemagick
# Modified from https://www.npmjs.com/package/videofy
function gif2video() {
fps="$(identify -format '%T\n' $@ | tail -1 | awk '{ print 100/$1 }')"
echo "GIF FPS: $fps"
convert "$@" gif2video_tmp_%05d.jpg
ffmpeg -f image2 -r $fps -i gif2video_tmp_%05d.jpg -c:v libx264 "$@.mp4"
@zachleat
zachleat / jquery.scrolly.js
Created April 5, 2011 19:52
jQuery scrolly special event
/*
* Changes by Zach Leatherman (@zachleat)
* from James Padolsey Special Scroll Events
* http://james.padolsey.com/javascript/special-scroll-events-for-jquery/
* -------------------------------------------------------
* Dual licensed under the MIT and GPL licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/copyleft/gpl.html
*/
@zachleat
zachleat / gist:4695349
Last active December 12, 2015 01:59
Talk abstract for Nebraska Code Camp 2013: Tool or Die (A Web Developer's Workflow)
“Tool and die makers are a class of machinists who work primarily in
toolroom environments—…often in an environment with flexible, semipermeable
boundaries from production work.”
These are the people that make the tools to make the products. This was the
environment I grew up in—watching my father work as a tool and die maker.
He could make anything! But more importantly, he knew the value of good
tools—even if you had to construct them yourself.
Tools are important and tooling for Web Development is improving! I'll go
@zachleat
zachleat / gist:5101237
Last active December 14, 2015 14:29
Speaker Backlog for NebraskaJS