Skip to content

Instantly share code, notes, and snippets.

@coreyrothwell
coreyrothwell / vim-notes
Last active August 29, 2015 14:06
VIM Notes
daw - delete a word and spaces
diw - delete only word
* - find next word under cursor
C-h delete a char
C-w delete last word
C-u delete current line
C-r0 paste
C-r=math calculate
@coreyrothwell
coreyrothwell / gist:8ee18e7b8b1e104e3f83
Last active August 29, 2015 14:06
Angularjs US Phone Filter
'use strict';
angular.module('whateverApp')
.filter('phone', function () {
return function (input) {
if(!input){
return '';
}
return input.replace(/(\d{3})(\d{3})(\d{4})/, '($1) $2-$3');
};
@coreyrothwell
coreyrothwell / gist:7328827
Created November 6, 2013 00:27
JavaScript Multiplication Table Weeeeeeeeeeeeeeeeeeee!!!
var res = '';
for(var i = 1; i <= 20; i++){
for(var j = 1; j <= 20; j++){
res += (i * j) + "\t\t";
}
console.log(res+"\n");
res = '';
}
@coreyrothwell
coreyrothwell / gist:5879880
Created June 27, 2013 20:03
jQuery replace input field commas. Just add a .no-comma class to the input and include this.
$(function(){
$('.no-comma').on('input',function(e){
var input = $(this),
newVal = input.val().replace(/\,/gi,'');
input.val(newVal);
});
});
@coreyrothwell
coreyrothwell / gist:5809187
Created June 18, 2013 20:46
CSS code for a wider modal window in Twitter Bootstrap.
.modal-big {
width: 940px;
width: 100%;
max-width: 750px;
margin-left:-375px;
}
@media (max-width: 767px) {
.modal-big {
width: auto;
margin-left: auto;
@coreyrothwell
coreyrothwell / iphone-input-zoom-fix.css
Last active July 28, 2017 15:14
Fix stupid iPhone input zoom-in on focus. CSS only fix.
@media (max-width:480px){
input, textarea {
font-size: 16px !important;
}
}