Skip to content

Instantly share code, notes, and snippets.

@thotbox
thotbox / CSS: Boilerplate.css
Created July 31, 2014 13:55
CSS: Boilerplate
.row {
max-width: 1920px;
}
.container {
padding: 0 15px;
}
.nopad {
padding: 0;
@thotbox
thotbox / JavaScript: Responsive Parallax.js
Created August 14, 2014 13:03
JavaScript: Responsive Parallax
// Parallax
$(document).ready(function(){
$window = $(window);
var width = $window.width();
$(window).bind('resize', function () {
width = $window.width();
});
$(window).scroll(function() {
// #hero
@thotbox
thotbox / Ping Pong Compare Timestamps.js
Created September 11, 2014 13:01
Ping Pong Compare Timestamps
// Ping Pong Compare Timestamps
setInterval(function () {
fetchEditDate('/fetch/edit-date/{segment_2}');
var origEditDate = $('#original-edit-date-field').val();
var fetchedEditDate = $('#fetched-edit-date-field').val();
if (fetchedEditDate > origEditDate){
location.reload();
}
},500);
@thotbox
thotbox / PHP: Test For Internet Connection.php
Created September 17, 2014 16:15
PHP: Test For Internet Connection
<?php
$connected = @fsockopen("www.workwiththey.com", 80);
if ($connected) {
echo "connected";
fclose($connected);
} else {
echo "not connected";
}
?>
@thotbox
thotbox / JavaScript: Placeholder Label Fallback.js
Last active August 29, 2015 14:15
JavaScript: Placeholder Label Fallback
// JS
if (!Modernizr.input.placeholder) {
$('.placeholder-fallback').addClass('fallback');
$('.has-placeholder').keyup(function() {
var fieldValue = $(this).val();
var fieldname = $(this).attr('name');
if (fieldValue === '') {
@thotbox
thotbox / Placeholder Focus Kill.js
Created February 18, 2015 14:42
Placeholder Focus Kill
// Placeholder Focus Kill
$('.has-placeholder').on('focus', function() {
var $field = $(this);
$field.attr({placeholderinactive : $field.attr('placeholder')}).removeAttr('placeholder');
});
$('.has-placeholder').on('blur', function() {
var $field = $(this);
$field.attr({placeholder : $field.attr('placeholderinactive')}).removeAttr('placeholderinactive');
@thotbox
thotbox / Mobile Phone Store Selector.js
Created February 24, 2015 14:57
Mobile Phone Store Selector
$(document).ready(function() {
if($('#bonus').length ) {
if ( /Android/i.test(navigator.userAgent) ) {
$('.store-ios').css('opacity', '.25');
$('.store-bb').css('opacity', '.25');
}
if ( /BlackBerry/i.test(navigator.userAgent) ) {
$('.store-ios').css('opacity', '.25');
$('.store-android').css('opacity', '.25');
}
@thotbox
thotbox / PHP: Database FTP Backup.php
Last active August 10, 2022 23:45
PHP: Database FTP Backup
<?
$dbhost = 'localhost';
$dbuser = 'db_user';
$dbpass = 'db_pass';
$dbname = 'db_name';
$ftphost = 'ftp_host';
$ftpuser = 'ftp_user';
$ftppass = 'ftp_pass';
@thotbox
thotbox / ExpressionEngine Switchee Meta Template.html
Last active August 29, 2015 14:18
ExpressionEngine Switchee Meta Template
{exp:switchee variable="{segment_1}" parse="inward"}
{!-- French --}
{case value="fr"}
{switchee variable="{segment_2}" parse="inward"}
{case value="services-famille"}
@thotbox
thotbox / JavaScript Browser Class.js
Last active August 29, 2015 14:18
JavaScript Browser Class
// Browser Class
$(document).ready(function() {
var agent = navigator.userAgent;
var browser;
if ( /Trident\/7.0/i.test(agent) ) {
browser = 'ie11';
}