Skip to content

Instantly share code, notes, and snippets.

@carlosasin
carlosasin / Custom.css
Last active December 14, 2015 11:19
A cobalt theme for Chrome Developer Tools inspired by Sublime Text 2 cobalt theme. Modifies the source code and other smaller tweaks.
/*
Cobalt theme by Carlos Asín
************************************
A cobalt theme for Chrome Developer Tools inspired by Sublime Text 2 cobalt theme.
Modifies the source code and other smaller tweaks.
@carlosasin
carlosasin / shuffle_array.js
Created August 20, 2013 15:51
JS - Shuffle array
//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com/array/shuffle [v1.0]
function shuffle(o){ //v1.0
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
}
@carlosasin
carlosasin / checkstr_zip.js
Created August 21, 2013 07:48
JS - Check correct ZIP code using pattern
// Check if zip is correct (number number number number number)
// @input str string to check
// @return bool
function check_zip(str) {
var zip = /^[0-9]{5}$/;
if (str != undefined && str.match(zip)) return true;
else return false;
}
@carlosasin
carlosasin / checkstr_mail.js
Created August 21, 2013 07:49
JS - Check correct Mail using pattern
// Check if mail is correct (leters @ leters . leters(2-4))
// @input str string to check
// @return bool
function check_mail(str) {
var ml = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (str != undefined && str.match(ml)) return true;
else return false;
}
@carlosasin
carlosasin / checkstr_phone.js
Created August 21, 2013 07:49
JS - Check correct Phone using pattern
// Check if phone is correct (accept + - ( ) 123456789)
// @input str string to check
// @return bool
function check_phone(str) {
var phn = /^([+]*[0-9]*[-]*[(]*[)]*\s*)*$/;
if (str != undefined && str.match(phn)) return true;
else return false;
}
@carlosasin
carlosasin / testdrive.sh
Created February 20, 2014 15:21
UNIX - Test drive speed
sudo hdparm -tT /dev/sda
TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
@carlosasin
carlosasin / gist:a8ae770b0ad461d6b773
Created June 10, 2014 07:56
Filewatcher SASS phpstorm
--no-cache --style compressed --update $FileName$:$FileNameWithoutExtension$.css
@carlosasin
carlosasin / iOS-7-web-app.html
Last active August 27, 2022 00:25 — forked from tfausak/ios-8-web-app.html
HTML - headers web app ios
<!doctype html>
<html>
<head>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
@carlosasin
carlosasin / permission.sh
Created October 2, 2014 08:26
Magento - Repair permissions
#!/bin/sh
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;
sudo chmod o+w var app/etc
sudo chmod 550 mage
sudo chmod -R o+w media