Skip to content

Instantly share code, notes, and snippets.

View raulb's full-sized avatar
👨‍💻
Ask me anything!

Raúl Barroso raulb

👨‍💻
Ask me anything!
View GitHub Profile
@raulb
raulb / ios-media-queries.sass
Created June 12, 2012 22:24 — forked from faun/ios-media-queries.sass
iOS Media Queries for iPhone/iPod, iPad & Retina and Non-Retina Devices
.ipad-only,
.iphone-only,
.retina-only,
.non-retina-only,
.retina-iphone-only,
.non-retina-iphone-only
display: none
// iPad Only
@media only screen and (device-width: 768px)
@raulb
raulb / example-user.js
Created May 4, 2012 22:19 — forked from nijikokun/example-user.js
Beautiful Validation... Why have I never thought of this before?!
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9-_]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
@raulb
raulb / gist:1091554
Created July 19, 2011 07:14 — forked from javierarce/gist:1090744
Color Picker bookmarklet for Dribbble.com
javascript: void((function() {
var colors = [];
var title = document.title.replace(/Dribbble - /g, '');
var li = document.getElementsByClassName('color');
if (li.length > 0) {
for (var i = 0; i < li.length; i++) {
var c = li[i].getElementsByTagName('a')[0].getAttribute('title');
colors.push('<li><div style="display:inline-block; width:20px; height:20px;background:' + c + '"></div> ' + c + '</li>');
}