Skip to content

Instantly share code, notes, and snippets.

bam boom bamdadam

Johannes Millan johannesjo

bam boom bamdadam
View GitHub Profile
johannesjo / pre-push
Last active Nov 18, 2019
Prevent git push to master locally
View pre-push
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
read -p "You're about to push $protected_branch, is that what you intended? [y|n] " -n 1 -r < /dev/tty
if echo $REPLY | grep -E '^[Yy]$' > /dev/null
johannesjo / table-to-json.js
Created Jun 28, 2016
Snippet to convert html table to json
View table-to-json.js
function tableToJson(table) {
var data = [];
// first row needs to be headers
var headers = [];
for (var i=0; i<table.rows[0].cells.length; i++) {
headers[i] = table.rows[0].cells[i].innerHTML.toLowerCase().replace(/ /gi,'');
// go through cells
johannesjo / rowMachineCalc
Created Apr 9, 2015
A row machine mixin that uses css calc to ease your rowing
View rowMachineCalc
@mixin rowMachineCalc($numPerRow, $margin) {
@include clearfix();
display: block;
> * {
width: calc(#{(100% / $numPerRow)} - #{(($numPerRow - 1) * $margin)/$numPerRow});
float: left;
&:nth-child(n) {
margin-bottom: $margin;
margin-right: $margin;
View Changing default document root in Plesk.html
Inorder to change default document root for a domain hosted in a plesk control panel we need to create vhost.conf file in the directory in which http.include for the domain resides. Directly changing the document root entry in httpd.include causes the modification to be overwritten with default entry since plesk overwrites entries in configuration files with database entries
Entries to be put in the vhost.conf follows
DocumentRoot /path/to/your/new/root
<Directory /path/to/your/new/root>
# Put this if you really need all options?
Options Indexes ExecCGI FollowSymLinks MultiViews
AddHandler cgi-script .cgi
# are you using .htaccess files? if not, set it from all to none
AllowOverride all
You can’t perform that action at this time.