Skip to content

Instantly share code, notes, and snippets.

@RemeJuan
RemeJuan / form_validation.js
Created August 26, 2014 08:05
Very basic form validation for jQeury, only useful if you do not want to use wbshims to pollyfill older browsers and simply nee to validate if a field has a value.
//Basic custom form validation
$('#formSave').on('click', function() {
$('input[data-required="true"]').each(function(){
if($(this).val() === '') {
$(this).addClass('required').val('This field is required');
}
});
if (cfarray.length === 0) {
$('#selectedResults').addClass('required').text('This field is required')
@RemeJuan
RemeJuan / HTML5_Blank.html
Last active August 29, 2015 14:05
HTML5 Blank HTML template
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Untitled Document</title>
</head>
<body>
</body>
@RemeJuan
RemeJuan / contents.css
Last active August 29, 2015 14:05
Default CSS File
/***********************************************************************************************/
/*
Contents
*/
/***********************************************************************************************/
@RemeJuan
RemeJuan / getQueryVAriables.js
Created September 15, 2014 13:00
Get query variables from url string with javascript
//Get query variables from URL string
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("="); if(pair[0] == variable) {
return pair[1];
}
}
@RemeJuan
RemeJuan / ajax_search.js
Last active August 29, 2015 14:06
AJAX search query returning JSON data from DB to populate UL
//Function to handle database search and process results
function getCustomers(searchQuery) {
$.ajax({
type: 'POST',
url: '/com/cfcs/SearchServices.cfc?method=searchCustomerByName&customerName=' + searchQuery + '&returnFormat=json',
datatype: 'json',
cache: false,
success: function(response)
{
var searchResults = response.DATA,
@RemeJuan
RemeJuan / browser_test.js
Last active August 29, 2015 14:07
Detect browser version using HTTP headers, add a class to the body tag as well as set a variable.
//Check browser version and apply classes to body where applicable
var body = document.getElementsByTagName('body')[0],
browserName,
browserVersion,
userAgent = navigator.appVersion.toLowerCase();
if (userAgent.indexOf("msie 8.") !== -1)
{
body.classList.add('ie8');
browserName = 'ie';
@RemeJuan
RemeJuan / wercker.yml
Created March 30, 2016 12:50
Complete docker sample file for automated deployment to digital ocean.
box: node
build:
steps:
- npm-install
deploy:
steps:
- script:
name: install nodemon
@RemeJuan
RemeJuan / style.css
Created April 4, 2016 06:31
Better responsive table
@media only screen and (max-width: 800px) {
.enhanced-responsive-table {
table, thead, tbody, th, td, tr {
display: block;
}
thead tr {
position: absolute;
top: -9999px;
left: -9999px;

Keybase proof

I hereby claim:

  • I am RemeJuan on github.
  • I am remejuan (https://keybase.io/remejuan) on keybase.
  • I have a public key whose fingerprint is 9FE2 6A96 E3E3 34A0 E323 8ED6 A932 9EF4 E20C E8E9

To claim this, I am signing this object:

@RemeJuan
RemeJuan / main.html
Last active November 15, 2016 06:08
Aurelia: First Impressions #1
<template>
<!--Importing a component into a template-->
<require from="component/component"></require>
<require from="other-component/other-component.html"></require>
<!--Displaying/rendering the imported component.-->
<component></component>
<other-component data-bind="stuff"></other-component>
</template>