Skip to content

Instantly share code, notes, and snippets.

@topalex
topalex / mime.html
Last active September 22, 2022 09:43
How to check real mime type of image in javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Mime type checker</title>
<script type="text/javascript" src="/jquery.min.js"></script>
<script>
$(function () {
var result = $('div#result');
if (window.FileReader && window.Blob) {
@atoponce
atoponce / gist:07d8d4c833873be2f68c34f9afc5a78a
Last active June 1, 2024 04:56 — forked from tqbf/gist:be58d2d39690c3b366ad
Cryptographic Best Practices

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

@daniellmb
daniellmb / onerror.js
Last active July 12, 2020 13:30
Automagically look up JavaScript errors on Stack Overflow ;-)
window.onerror = function(message) {
top.location.href = 'http://stackoverflow.com/search?q=' +
encodeURIComponent(message + ' [js]');
};
@iangreenleaf
iangreenleaf / gist:b206d09c587e8fc6399e
Last active June 1, 2024 14:36
Rails naming conventions

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@chris-hailstorm
chris-hailstorm / clean_mac_files_from_zip.sh
Created December 2, 2012 01:32 — forked from 9re/clean_mac_files_from_zip.sh
remove __MACOSX and .DS_Store files from zip files
##
## zip command itself can clean it up for you
Can be fixed after the fact by `zip -d filename.zip __MACOSX/\*`
@malarkey
malarkey / Contract Killer 3.md
Last active May 24, 2024 23:38
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@bminer
bminer / changeTypeAttr.js
Created August 31, 2012 21:30
Cross-browser solution for changing the 'type' attribute of an `<input/>` tag.
/* x is the <input/> element
type is the type you want to change it to.
jQuery is required and assumed to be the "$" variable */
function changeType(x, type) {
if(x.prop('type') == type)
return x; //That was easy.
try {
return x.prop('type', type); //Stupid IE security will not allow this
} catch(e) {
//Try re-creating the element (yep... this sucks)
@matthutchinson
matthutchinson / fakeout.rb
Created May 10, 2012 16:59
fake.rake - a takeout approach and rake task that generates some random fake data for a rails app (using ffaker)
# place this in lib/fakeout.rb
require 'ffaker'
module Fakeout
class Builder
FAKEABLE = %w(User Product)
attr_accessor :report
@jackfuchs
jackfuchs / jquery.support.cssproperty.js
Last active January 13, 2024 16:07
Extends the jQuery.support object to CSS Properties
/**
* jQuery.support.cssProperty
* To verify that a CSS property is supported
* (or any of its browser-specific implementations)
*
* @param p css property name
* @param rp optional, if set to true, the css property name will be returned
* instead of a boolean support indicator
* @return {mixed}
*