Skip to content

Instantly share code, notes, and snippets.

@Akshay-Hegde
Akshay-Hegde / field.geocoder.php
Last active August 29, 2015 14:11
Field geocoder small validation, PyroCMS
<?php defined('BASEPATH') or exit('No direct script access allowed');
/**
* PyroStreams Geocoder Field Type
*
* Generate longitude and latitude from a specified location
*
* @package PyroStreams
* @author David Lewis
* @copyright Copyright (c) 2012, David Lewis
@Akshay-Hegde
Akshay-Hegde / jqxdatatable.js
Created March 4, 2015 16:05
jqxdatatable.js modified version - horizontalScrollerSupport
/*
jQWidgets v3.5.0 (2014-Sep-15)
Copyright (c) 2011-2014 jQWidgets.
License: http://jqwidgets.com/license/
*/
(function(g){function K(a,b){this.owner=a;this.displayfield=this.datafield=null;this.text="";this.editable=this.sortable=!0;this.hidden=!1;this.groupable=this.hideable=!0;this.columntype=this.cellsrenderer=this.renderer=null;this.cellsformat="";this.cellsalign=this.align="left";this.width="auto";this.minwidth=25;this.maxwidth="auto";this.pinned=!1;this.visibleindex=-1;this.filterable=!0;this.filter=null;this.draggable=this.resizable=!0;this.validation=this.geteditorvalue=this.destroyeditor=this.createeditor=
this.initeditor=null;this.cellclassname=this.classname="";this.rendered=this.aggregatesrenderer=this.aggregates=null;this.nullable=this.exportable=!0;this.columngroup=null;this.columntype="textbox";this.getcolumnproperties=function(){return{nullable:this.nullable,sortable:this.sortable,hidden:this.hidden,groupable:this.groupable,width:this.width,align:this.align,editable:this.editable,minwidth:th
@Akshay-Hegde
Akshay-Hegde / GlobalMercator.php
Created April 19, 2017 09:23 — forked from ramunasd/GlobalMercator.php
GlobalMercator.php provides support for converting between latitude and longitude coordinates and a “quadtree” representation that makes it easy to search a database for physically close points.
<?php
/*
GlobalMercator - part of Aggregate Map Tools
Version 1.0
Copyright (c) 2009 The Bivings Group
All rights reserved.
Author: John Bafford
http://www.bivings.com/
http://bafford.com/softare/aggregate-map-tools/
@Akshay-Hegde
Akshay-Hegde / gist:0708b0398014ff0b215275771c430dd2
Created August 9, 2018 04:25 — forked from fduran/gist:4622779
MySQL Master-Slave Replication
# www.fduran.com
MySQL Master-Slave Replication Notes
Master
/etc/mysql/my.cnf
server-id = 100
log_bin = /var/log/mysql/mysql-bin.log
binlog-do-db = wpdb
binlog-ignore-db = mysql
@Akshay-Hegde
Akshay-Hegde / bootstrap3-alert-box.js
Created September 7, 2018 12:56 — forked from jnormore/bootstrap3-alert-box.js
Bootstrap 3 alert and confirm modals. Overrides window.alert normally, but window.confirm override requires a callback function to be passed to get result. Optional arguments for modal title and confirm button label.
window.alert = function(message, title) {
if($("#bootstrap-alert-box-modal").length == 0) {
$("body").append('<div id="bootstrap-alert-box-modal" class="modal fade">\
<div class="modal-dialog">\
<div class="modal-content">\
<div class="modal-header" style="min-height:40px;">\
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>\
<h4 class="modal-title"></h4>\
</div>\
<div class="modal-body"><p></p></div>\
@Akshay-Hegde
Akshay-Hegde / LICENSE
Created January 17, 2019 09:27 — forked from donnierayjones/LICENSE
Render Bootstrap as "small" layout when printing
Copyright (C) 2016 Donnie Ray Jones
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@Akshay-Hegde
Akshay-Hegde / fontStacks.css
Created January 24, 2019 12:56 — forked from kkemple/fontStacks.css
Font Stacks with all browser based fonts
/* Times New Roman-based stack */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
/* Modern Georgia-based serif stack */
font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif;
/* Traditional Garamond-based serif stack */
font-family: "Palatino Linotype", Palatino, Palladio, "URW Palladio L", "Book Antiqua", Baskerville, "Bookman Old Style", "Bitstream Charter", "Nimbus Roman No9 L", Garamond, "Apple Garamond", "ITC Garamond Narrow", "New Century Schoolbook", "Century Schoolbook", "Century Schoolbook L", Georgia, serif;
/* Helvetica/Arial-based sans serif stack */
@Akshay-Hegde
Akshay-Hegde / cspheader.php
Created May 3, 2019 13:36 — forked from phpdave/cspheader.php
CSP Header for PHP or Apache or .htaccess - Content Security Protocol
<?
//CSP only works in modern browsers Chrome 25+, Firefox 23+, Safari 7+
$headerCSP = "Content-Security-Policy:".
"connect-src 'self' ;". // XMLHttpRequest (AJAX request), WebSocket or EventSource.
"default-src 'self';". // Default policy for loading html elements
"frame-ancestors 'self' ;". //allow parent framing - this one blocks click jacking and ui redress
"frame-src 'none';". // vaid sources for frames
"media-src 'self' *.example.com;". // vaid sources for media (audio and video html tags src)
"object-src 'none'; ". // valid object embed and applet tags src
"report-uri https://example.com/violationReportForCSP.php;". //A URL that will get raw json data in post that lets you know what was violated and blocked
###############################################################################################
# LAMP setup for Ubuntu 16.04 Server #
# Apache + PHP + Percona #
###############################################################################################
# Update and prepare server
apt update; apt -y upgrade
apt -y install nano sudo curl wget git dnsutils lynx
sudo hostname srv.zdb.bz
sudo service hostname start
@Akshay-Hegde
Akshay-Hegde / generate_openvpn_config.sh
Created November 12, 2019 13:47 — forked from dmytro/generate_openvpn_config.sh
Script for OpenVPN generate client config file.
#!/bin/bash
# Easy script to create OpenVPN client configuration with the user, pre-generating user's
# RSA key and certificate.
#
# Configuration template must exist in the same directory, with only missing part: certificates.
#
# (c) Dmytro Kovalov, 2015
#
cd $(dirname ${BASH_SOURCE[0]})