Skip to content

Instantly share code, notes, and snippets.

View marknt15's full-sized avatar

Mark Edward Tan marknt15

View GitHub Profile
@marknt15
marknt15 / gist:a5524811df075707f23cf6b762d7d69d
Created May 3, 2018 06:20 — forked from jtdp/gist:5443297
See changes before pulling from remote git repository
# fetch the changes from the remote
git fetch origin
# show commit logs of changes
git log master..origin/master
# show diffs of changes
git diff master..origin/master
# apply the changes by merge..
@marknt15
marknt15 / default
Created April 22, 2018 14:55 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@marknt15
marknt15 / mamp.md
Created April 7, 2018 14:26 — forked from jfloff/mamp.md
How to get MAMP to work with SSL ... Yes really.

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you:

@marknt15
marknt15 / gitcom.md
Created March 15, 2018 02:44 — forked from jednano/gitcom.md
Common git commands in a day-to-day workflow

Git Cheat Sheet

Initial Setup

Create an empty git repo or reinitialize an existing one

$ git init
@marknt15
marknt15 / gist:78d9c4f07b6658964493
Created June 1, 2015 07:00
jQuery toggle checkbox on and off
// check if checkbox is checked
if ($("#toggle_start").is(':checked')) {
var datetimepicker_start = $("#datetimepicker_start").val();
} else {
var datetimepicker_start = 'disabled';
}
@marknt15
marknt15 / gist:8a0f35edb494d3b3fb9f
Last active August 29, 2015 14:22
Mac OSX development tools
Mac OSX development:
- composer
- sublime text 2
- PHP Storm
- Source Tree
- Spotify
- Slack
- GistBox
- Transmit
@marknt15
marknt15 / gist:521c833be5248f675ea7
Created May 29, 2015 07:29
PHP DateTime usage - compare dates, subtract dates and get hours or days
<?php
$ammended_start = DateTime::createFromFormat('g:i a D j M', Request::input('ammended_start_' . $time_ammendments_id))->getTimeStamp();
$ammended_finish = DateTime::createFromFormat('g:i a D j M', Request::input('ammended_finish_' . $time_ammendments_id))->getTimeStamp();
$date1 = new DateTime(date("Y-m-d H:i:s", $v->start_timestamp));
$date2 = new DateTime(date("Y-m-d H:i:s", $v->finish_timestamp));
$diff = $date2->diff($date1);
$elapsed = $diff->format('%a days %h hours %i minutes %S seconds');
?>
@marknt15
marknt15 / bootstrap_datetimepicker_limit.js
Created May 28, 2015 03:21
Create Bootstrap DateTimePicker with Range Start and Finish. Dependent to each other so no extra validation will be added.
$("#datetimepicker_start, #datetimepicker_finish").datetimepicker({
format: 'h:mm a ddd D MMM'
});
$("#datetimepicker_start").on("dp.change", function (e) {
$('#datetimepicker_finish').data("DateTimePicker").minDate(e.date);
});
$("#datetimepicker_finish").on("dp.change", function (e) {
$('#datetimepicker_start').data("DateTimePicker").maxDate(e.date);
});
alert('Hello World');
@marknt15
marknt15 / helloworld.php
Created June 22, 2013 14:03
Test - my 1st gist. This is the description
<?php
echo 'Hello World';
?>