Skip to content

Instantly share code, notes, and snippets.

View khoerodin's full-sized avatar
:octocat:
Meow everyday

Khoerodin khoerodin

:octocat:
Meow everyday
View GitHub Profile
@khoerodin
khoerodin / jekyll-and-liquid.md
Created February 24, 2017 01:21 — forked from magicznyleszek/jekyll-and-liquid.md
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@khoerodin
khoerodin / concat.liquid
Created February 24, 2017 01:20 — forked from BryanSchuetz/concat.liquid
Concat arrays in Jekyll(liquid)
{% assign all_hosts = "" | split: "" %}
{% for host in site.data.shared_hosts %}
{% assign all_hosts = all_hosts | push: host %}
{% endfor %}
{% for host in site.data.paas_hosts %}
{% assign all_hosts = all_hosts | push: host %}
{% endfor %}
@khoerodin
khoerodin / Laravel PHP7 LEMP AWS.md
Created January 25, 2017 04:06 — forked from santoshachari/Laravel PHP7 LEMP AWS.md
Laravel 5.x on Ubuntu 14.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 14.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@khoerodin
khoerodin / Virtual Blocks on Nginx.md
Created January 25, 2017 03:41 — forked from santoshachari/Virtual Blocks on Nginx.md
Setup additional sites on Nginx

Inspired and edited from this Digital Ocean tutorial.

Follow the steps on this gist to setup a LEMP stack with PHP 7.0.

The steps assume Nginx has been configured correctly.

Setup the root directories

For the domains example.com and test.com, create the folders.

@khoerodin
khoerodin / docker-stop.sh
Last active January 24, 2017 15:56
Stop All Docker Containers, Delete All Docker Containers and Images
#!/bin/bash
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)

Modifying an Existing Docker Image

To install a custom package or modify an existing docker image we need to

  1. run a docker a container from the image we wish to modify
  2. modify the docker container
  3. commit the changes to the container as a docker image
  4. test changes made to image

1.) Running a docker container from an image

@khoerodin
khoerodin / shorten-strings-whole-word-character-count-php.php
Created January 21, 2017 10:24
Truncate (Shorten) Strings to the Nearest Whole Word or Character Count with Trailing Dots using PHP Functions
<?php
/*
Truncate (Shorten) Strings to the Nearest Whole Word or Character Count with Trailing Dots with PHP
http://www.internoetics.com/2016/02/01/shorten-strings-whole-word-character-count-php/
*/
/* String to be used in all examples */
$string = 'Looorem ipsum velit inceptos posuere augue amet sagittis augue sapien gravida vestra nulla non hac ac luctus imperdiet pulvinar ligula hac elit molestie vestibulum fusce porttitor lacinia.';
$string2 = 'Lorem ipsum velit inceptos posuere augue amet sagittis augue sapien gravida vestra.';
@khoerodin
khoerodin / DatabaseSeeder.php
Created December 9, 2016 00:43
Laravel DatabaseSeeder.php example that truncates all tables before seeding them.
<?php
use App;
use DB;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class DatabaseSeeder extends Seeder
{
/**
@khoerodin
khoerodin / baseConverter.js
Created November 10, 2016 09:44 — forked from faisalman/baseConverter.js
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@khoerodin
khoerodin / sublime_keyboard_shortcuts.rst
Last active September 4, 2016 10:52
Sublime Text Keyboard Shortcut for Windows/Linux

Keyboard Shortcuts - Windows/Linux

Warning

This topic is a draft and may contain wrong information.

Editing