Skip to content

Instantly share code, notes, and snippets.

@cjwebdev
cjwebdev / gist:f362f25c2999e1d7dde9
Last active May 4, 2016 05:20
HTML: Starting Template
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<title></title>
<!-- Meta -->
<meta charset="utf-8">
<meta name="keywords" content="">
@cjwebdev
cjwebdev / scopes.txt
Last active August 29, 2015 14:08 — forked from iambibhas/scopes.txt
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@cjwebdev
cjwebdev / gist:f48c7970abcf2d18516f
Last active April 26, 2016 04:43
HTML: Email Template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title></title>
<style type="text/css">
/* Reset */
body{-webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; }
.wrapper {display: table; table-layout: fixed; margin:0; padding:0; width:100% !important; line-height: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; text-rendering: optimizeLegibility;}
@cjwebdev
cjwebdev / gist:8bfe85d27cde51eaa538
Last active October 24, 2018 00:38
jQuery: Responsive Breakpoint Plugin
/*
* Responsive Page Modes Plugin - Responsive page modes based on window width
* http://cjweb.com.au
* Version: 1.0.0 (11-NOVEMBER-2014)
* Dual licensed under the MIT and GPL licenses.
*
* USAGE INSTRUCTIONS
*
* Load with:
*
@cjwebdev
cjwebdev / gist:3fe63af07f1910a5836f
Last active June 18, 2018 03:55
jQuery: Equal Column Heights Plugin
/*
* EqCol - Equalise Grid column heights
* Requires "Responsive Page Modes Plugin"
* http://cjweb.com.au
* Version: 1.0.0 (11-NOVEMBER-2014)
* Dual licensed under the MIT and GPL licenses.
*
* USAGE INSTRUCTIONS
* $('.grid').eqCol(); // <ul class="grid" data-eqcol-mode="medium,large" data-eqcol-item=".grid-col" >
*
@cjwebdev
cjwebdev / gist:a68b060039bc22016d01
Created January 6, 2015 23:33
Video: Embed YouTube with external controls
<iframe id="video" src="//www.youtube.com/embed/FKWwdQu6_ok?showinfo=0&amp;rel=0&amp;wmode=opaque&amp;autohide=1&amp;autoplay=1&amp;enablejsapi=1&amp;html5=1" frameborder="0" allowfullscreen></iframe>
<script>
// http://css-tricks.com/play-button-youtube-and-vimeo-api/
// https://developers.google.com/youtube/iframe_api_reference
// global variable for the player
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
<html>
<head>
<style>
div input[type=radio]{
position: absolute;
visibility: hidden;
}
@cjwebdev
cjwebdev / gist:3c787120368f362e26c97ae9943dd9ce
Created October 12, 2017 03:11
JS Querystring Paramters
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
//getParameterByName('var')
}
//Basic form validation
$('form[novalidate]').on('submit', function(event){
$('.form-control', this).each(function(){
if (this.checkValidity() == false || ($(this).attr('data-match') && $(this).val() != $('#' + $(this).attr('data-match')).val())) {
event.preventDefault();
event.stopPropagation();
$(this).parents('.form-group').addClass('has-error');
}
else {
$(this).parents('.form-group').removeClass('has-error');