Skip to content

Instantly share code, notes, and snippets.

View nmsdvid's full-sized avatar
🏠
Working from home

David Nemes nmsdvid

🏠
Working from home
View GitHub Profile
@nmsdvid
nmsdvid / gist:3713432
Created September 13, 2012 10:25
jQuery plugin pattern
/*
* <plugin name>
* version <number>
* author: <author name>
* <web site, twitter, etc...>
*/
(function($){
function initialize($obj, option1, option2, option3){
@nmsdvid
nmsdvid / gist:4113054
Created November 19, 2012 19:22
Debugging CSS Media Queries
Debugging CSS Media Queries with CSS. Based on the idea by Johan Brook.
article: http://bit.ly/j3BWaw
body.debug::before {
content: "Tablet media query (media query) fired";
font-weight: bold;
display: block;
text-align: center;
background: rgba(255,255,0, 0.9);
position: absolute;
@nmsdvid
nmsdvid / gist:4559253
Created January 17, 2013 20:07
Retina Background Image w CSS
/* for low resolution display */
.image {
background-image: url(/path/to/my/lowreslogo.png);
background-size: 200px 300px;
height: 300px;
width: 200px;
}
/* for high resolution display */
@media only screen and (min--moz-device-pixel-ratio: 2),
only screen and (-o-min-device-pixel-ratio: 2/1),
@nmsdvid
nmsdvid / Load JS SDK
Last active January 11, 2022 08:15
Facebook API - using the latest Facebook API with success
//Call the Facebook JavaScript SDK
<div id="fb-root"></div>
<script>
// Called when FB SDK has been loaded
window.fbAsyncInit = function() {
FB.init({
appId : 'XXXXXXXXX', // App ID
status : true, // check login status
@nmsdvid
nmsdvid / gist:5564566
Last active December 17, 2015 06:19
Gzip compression
# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------
<IfModule mod_deflate.c>
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
@nmsdvid
nmsdvid / vertical-align-css
Created January 15, 2014 20:35
Vertical align anything with just 3 lines of CSS
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
SASS:
@mixin vertical-align {
position: relative;
@nmsdvid
nmsdvid / cssstyle
Created January 29, 2014 09:05
Style Checkbox with CSS
input[type="checkbox"] {
display:none;
}
input[type="checkbox"] + label span {
display:inline-block;
width:21px;
height:21px;
background:url(check.png);
margin:0 6px 0 0;
@nmsdvid
nmsdvid / new_gist_file.js
Created February 4, 2014 16:32
Simple JavaScript Debounce Function
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
clearTimeout(timeout);
@nmsdvid
nmsdvid / gist:9067101
Last active April 6, 2022 08:16 — forked from pitch-gist/gist:2999707
simple coming soon page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@nmsdvid
nmsdvid / new_gist_file.css
Created March 4, 2014 17:37
Super responsive image
.responsive-img {
width: auto\9;
height: auto;
max-width: 100%;
vertical-align: middle;
border: 0;
-ms-interpolation-mode: bicubic;
}