Skip to content

Instantly share code, notes, and snippets.

@snowbob
snowbob / mask
Last active August 29, 2015 13:57
js mask page on submit
<div id="mask"></div>
#mask{
position:fixed;
width:100%;
height:100%;
background: black rgba(0,0,0,.3); /* You can make this slightly transparent or transparent */;
top:0;
left:0;
display:none;
@snowbob
snowbob / js: jquery key combo
Last active August 29, 2015 13:57
js key down combinations like ctrl+a
$(document).keydown(function(e){
if(e.ctrlKey && e.keyCode == 65){
// do some stuff
}
if(e.ctrlKey && e.keyCode == 78){
// do some stuff
}
})
@snowbob
snowbob / html: fixed header
Last active August 29, 2015 13:58
html fixed header
<div class="panel panel-default">
<table class="table table-condensed" >
<thead>
<tr>
<th>Col1</th>
<th>Col2</th>
<th>Col3</th>
</tr>
</thead>
</table>
@snowbob
snowbob / js: redirect
Created April 14, 2014 10:47
js: redirect after set time
setTimeout(function() {
window.location.href = "http://test.example.com/;"
}, 5000);
@snowbob
snowbob / bs: tab layout
Created April 16, 2014 10:15
bs: tab layout
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<div class="tabbable" id="tabs-347287">
<ul class="nav nav-tabs">
<li class="active">
<a href="#panel-947812" data-toggle="tab">Section 1</a>
</li>
<li>
<a href="#panel-240432" data-toggle="tab">Section 2</a>
@snowbob
snowbob / js: iframe refresh
Created April 28, 2014 12:51
js: refresh iframe
var iframe = document.getElementById(FrameId);
iframe.src = iframe.src;
@snowbob
snowbob / equal heights
Created May 10, 2014 19:26
js: equal heights
var currentTallest = 0,
currentRowStart = 0,
rowDivs = new Array(),
$el,
topPosition = 0;
$('.blocks').each(function() {
$el = $(this);
topPostion = $el.position().top;
@snowbob
snowbob / sticky footer
Created May 10, 2014 20:19
js: sticky footer
@snowbob
snowbob / js: file exitst
Created May 26, 2014 10:35
js: check if file exists
$(".check-file").change(function(){
var $this = $(this),
value = $this.val().replace(/c:\\fakepath\\/i, ''),
url = '<?php echo WEB_ROOT;?>admin/upload/csv/'
if(value!=''){
$.get(url+value)
.done(function() {
alert('File you have selected has already been uploaded, please check the list below for details.')
@snowbob
snowbob / php: mass insert
Last active August 29, 2015 14:01
php: mass insert
$sql = array();
foreach( $data as $row ) {
$sql[] = "('".mysql_real_escape_string($row['text'])."', '".$row['category_id']."')";
}
mysql_query('INSERT INTO table (text, category) VALUES '.implode(',', $sql));