Skip to content

Instantly share code, notes, and snippets.

@vordan
vordan / alert-fade-out.js
Last active August 29, 2015 14:06
Bootstrap 3: Show alert for 3.5 seconds and fade it out
$('.alert').removeClass('hide').show().delay(1000).addClass("in").fadeOut(3500);
@vordan
vordan / jqgrid-initialize.js
Created July 4, 2015 17:30
jqGrid initialization
pub.grd_mailing_campaign.jqGrid({
url: 'bl/bl_mailing_campaign.php',
postData: {
action : function() {return 'mailing_campaign_list';},
record_count : function() {return _recipients_grid_record_count();},
},
datatype: 'json',
mtype: 'POST',
jsonReader : {repeatitems: false},
caption: '',
@vordan
vordan / show-ip.sh
Created July 16, 2015 05:39
Show IP address only in Linux
ip addr show tun0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1
@vordan
vordan / exclude-tables.sh
Created July 16, 2015 05:40
Exclude tables from mysqldump
mysqldump -u username -p database --ignore-table=database.table1 --ignore-table=database.table2 > database.sql
@vordan
vordan / round-precise.js
Created August 31, 2015 18:13
Precise rounding of numbers
function round_precise(value, exp) {
if (typeof exp === 'undefined' || +exp === 0)
return Math.round(value);
value = +value;
exp = +exp;
if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0))
return NaN;
@vordan
vordan / convert-encoding.sh
Created September 14, 2015 13:37
Convert file encoding
iconv -f ISO-8859-14 Agreement.txt -t UTF-8 -o agreement.txt
@vordan
vordan / new_gist_file_0
Created December 1, 2015 19:31
Repair apt-get update
sudo rm -r /var/lib/apt/lists
sudo mkdir -p /var/lib/apt/lists/partial
sudo apt-get clean
sudo apt-get update
sudo apt-key list | grep expired
@vordan
vordan / new_gist_file_0
Created December 9, 2015 15:53
Bootstrap Date Picker
$('#user_edit_date_of_registration').datepicker('setValue', _row_model.value);
var _value = formatDateISO(nz($('#user_edit_date_of_registration').data('date')));
<div id="user_edit_date_of_registration" class="input-append date" data-index="" data-date="" data-date-format="dd-mm-yyyy" data-date-viewmode="months">
<input type="text" class="input-small">
<span class="add-on"><i class="fa fa-calendar"></i></span>
</div>
@vordan
vordan / new_gist_file_0
Last active January 16, 2016 10:38
Export на ценовник од Google Spreadsheet за web сајт на Инфопројект
- Во Google Spreadsheet, избери File->Download as->Web page (zip)
- Отпакувај го зипот
- Отвори го фајлот со ценовникот (нпр. основни-модули.html)
- Отвори го фајлот resources/sheet.css и копирај ја целата содржина (вообичаено, има еден ред)
- Во датотеката со ценовникот
- Стави таг <style type="text/css">
- На почетокот, вметни го копираниот CSS
- После тоа, вметни го следниов код:
.waffle {overflow-x:scroll;overflow-y:visible;width:100%;margin-left: 238px;}
th:first-child, thead {display:none;}
@vordan
vordan / multi_dashboard.html
Created January 31, 2016 08:35 — forked from battlehorse/multi_dashboard.html
A Google Charts dashboard setup where multiple datatables are used to power a single 'logical' dashboard.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
Google Visualization API Sample
</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['controls']});