Skip to content

Instantly share code, notes, and snippets.

View czmole's full-sized avatar
🚀
Working on a dream

Catalin Zmole czmole

🚀
Working on a dream
View GitHub Profile
@czmole
czmole / ICS.php
Created June 4, 2018 12:27 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* ICS.php
* =======
* Use this class to create an .ics file.
*
* Usage
* -----
* Basic usage - generate ics file contents (see below for available properties):
@czmole
czmole / font-awesome-mime-type-icons.php
Created April 26, 2018 12:39 — forked from colemanw/font-awesome-mime-type-icons.php
Font Awesome File Icons: Mapping MIME Types to correct icon classes
<?php
/**
* Get font awesome file icon class for specific MIME Type
* @see https://gist.github.com/guedressel/0daa170c0fde65ce5551
*
*/
function ($mime_type) {
// List of official MIME Types: http://www.iana.org/assignments/media-types/media-types.xhtml
$icon_classes = array(
@czmole
czmole / Instructions.md
Created April 24, 2018 11:39 — forked from jmdobry/Instructions.md
Nginx reverse-proxy for RethinkDB Admin UI

Start your rethinkdb instance with this flag: --bind all (or bind=all in the configuration file for your instance)

Block external access to the web UI with these two commands: sudo iptables -A INPUT -i eth0 -p tcp --dport 8080 -j DROP sudo iptables -I INPUT -i eth0 -s 127.0.0.1 -p tcp --dport 8080 -j ACCEPT

Install nginx: sudo apt-get install nginx

@czmole
czmole / create-mysql.bash
Created January 4, 2018 15:11 — forked from omeinusch/create-mysql.bash
Simple bash script to create mysql db, user with generated password
#!/bin/bash
PASS=`pwgen -s 40 1`
mysql -uroot <<MYSQL_SCRIPT
CREATE DATABASE $1;
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS';
GRANT ALL PRIVILEGES ON $1.* TO '$1'@'localhost';
FLUSH PRIVILEGES;
MYSQL_SCRIPT
@czmole
czmole / API.md
Created October 30, 2017 10:53 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@czmole
czmole / build.sh
Created October 30, 2017 08:24
Script for building Ubuntu 16.04 server + LAMP + Redis, Memcached, Lets Encrypt, Git, Composer + Optimisations
## Builder for Ubuntu 16.04 ##
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get autoclean
sudo apt-get --purge autoremove
# Install dependancies
sudo apt-get install curl git unzip
@czmole
czmole / jquery-scroll-bottom.js
Created October 13, 2017 08:34 — forked from toshimaru/jquery-scroll-bottom.js
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
@czmole
czmole / gist:49f3eb79c1aaf99352de67b7a4fcd5d9
Created September 19, 2017 11:06 — forked from mintindeed/gist:4600385
Bash script for git pull using username and password
#!/bin/bash
path="/var/www/sites/htdocs/wp-content/themes/vip/";
git_path="https://username:password@bitbucket.org/penskemediacorp/";
git_array=( plugins pmc-variety pmc-plugins );
git_path_array=("${git_array[@]}")
@czmole
czmole / curl.md
Created September 7, 2017 09:42 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@czmole
czmole / .env.example
Created May 24, 2017 05:57 — forked from iolson/.env.example
GitLab CI Laravel 5.1.*
DB_HOST=mysql
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret