Skip to content

Instantly share code, notes, and snippets.

View JoeChapman's full-sized avatar
🎯
Focusing

JoeChapman JoeChapman

🎯
Focusing
View GitHub Profile
@JoeChapman
JoeChapman / webkit-placeholder-colour.css
Created February 1, 2012 21:49
Placeholder text colour
::-webkit-input-placeholder {
color: #999;
}
@JoeChapman
JoeChapman / mozilla-placeholder-text-colour.css
Created February 1, 2012 21:50
Placeholder text colour Mozilla
:-moz-placeholder {
color: #999;
}
@JoeChapman
JoeChapman / ie10-placeholder-text-colour.css
Created February 1, 2012 21:53
Placeholder text colour IE10
:-ms-input-placeholder {
color: red;
}
@JoeChapman
JoeChapman / iOs-placeholder-text-colour.css
Created February 1, 2012 21:56
Placeholder text colour iOS
:focus::-webkit-input-placeholder{
color:transparent;
}
@JoeChapman
JoeChapman / getItem.js
Created February 8, 2012 09:09 — forked from roundcorners/getItem.js
Return an object's key value based on the position of the key
var getItem = function(obj, i) {
var key, arr = [];
for (key in obj) {
arr.push(obj[key]);
}
return arr[i];
};
@JoeChapman
JoeChapman / getRealType.js
Created February 22, 2012 12:28
Function to return real type of the object
var getRealType = function (o) {
return Object.prototype.toString.call(o).match(/\w+/g)[1].toLowerCase();
};
@JoeChapman
JoeChapman / validator.js
Created February 24, 2012 14:22
validator object, compares user input (data) against config object and fires callbacks on result
/**
* @author: joseph chapman
* @email
* @dependencies: sky
* @name: validator
* @dependencies validator.types and validator.config
*/
(function($, window, validator, undefined) {
@JoeChapman
JoeChapman / validator.types.js
Created February 24, 2012 14:29
Defines types validation
(function($, window, validator, undefined) {
validator.types = {
isValidEmail: {
validate: function(value) {
return '/^$/'.test(value);
},
instructions: 'Please enter a valid email address',
errorHandler: function() {
validate.instructions;
@JoeChapman
JoeChapman / validator.config.js
Created February 24, 2012 15:22
Defines what types are required to validate fields
(function ($, window, validator, undefined) {
validator.config = {
email: 'isValidEmail',
name: 'notEmpty'
};
}(jQuery, window, (validator || {}));
@JoeChapman
JoeChapman / simple-sort-method.js
Created March 21, 2012 13:54
Basic example of JavaScript sort method
var arr = ['b', 'f', 'a', 'z', 't'];
arr.sort();
// Result
a,b,f,t,z