Skip to content

Instantly share code, notes, and snippets.

@ivanbarlog
ivanbarlog / install.adminer.sh
Last active August 29, 2015 14:08
Installation script for Adminer - LAMP on Ubuntu
#!/bin/bash
V=${1-"4.2.0"}
curl http://www.adminer.org/latest-en.php -L --create-dirs -o /var/www/src/adminer-${V}/index.php
chown -R ivan:ivan adminer-${V}/
chmod -R 0755 adminer-${V}/
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/adminer-${V}.conf
sed -i -e 's/#ServerName www.example.com/ServerName adminer.dev/g;s/\/var\/www\/html/\/var\/www\/http\/adminer/g;s/.log/_adminer.log/g' /etc/apache2/sites-available/adminer-${V}.conf
@ivanbarlog
ivanbarlog / install.symfony.project.sh
Created January 19, 2015 22:47
Set up Symfony project in Ubuntu linux
#!/bin/bash
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
echo "Provide first argument which is path to project relative to /var/www/src/ folder"
echo "Provide second argument which is domain which will be added to hosts file (.dev is added automatically)"
exit
fi
@ivanbarlog
ivanbarlog / factorial.c
Last active September 21, 2016 21:04
Power of recursion
#include <stdio.h>
unsigned int factorial(unsigned int x);
int main() {
/* testing code */
printf("1! = %i\n", factorial(1));
printf("3! = %i\n", factorial(3));
printf("5! = %i\n", factorial(5));
}
@ivanbarlog
ivanbarlog / labels.sh
Last active January 28, 2016 13:44
Adding github labels via bash script
#!/bin/bash
read -p "repository (owner/repository): " REPO
read -p "user: " USER
read -p "password: " -s PASS
# Delete default labels
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$REPO/labels/bug"
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$REPO/labels/duplicate"
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$REPO/labels/enhancement"
/*!
* Nestable jQuery Plugin - Copyright (c) 2014 Ramon Smit - https://github.com/RamonSmit/Nestable
*/
;
(function($, window, document, undefined) {
var hasTouch = 'ontouchstart' in window;
/**
* Detect CSS pointer-events property
* events are normally disabled on the dragging element to avoid conflicts
@ivanbarlog
ivanbarlog / 0_reuse_code.js
Created March 1, 2016 13:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ivanbarlog
ivanbarlog / Slugifier.php
Created September 21, 2016 20:59
Slugifier helper class
<?php
namespace ib\Misc;
/**
* Class Slugifier.
* @author Ivan Barlog <ivan.barlog@everlution.sk>
*/
class Slugifier
{