Skip to content

Instantly share code, notes, and snippets.

View marlonfan's full-sized avatar
👋
: )

marlon marlonfan

👋
: )
View GitHub Profile
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
function stringify(obj, whitespace, isChild) {
if (!obj) {
return 'null';
}
var output = (obj instanceof Array ? '[' : '{') + '\n';
for (var i = 0, keyList = Object.keys(obj), l = keyList.length; i < l; i++ ) {
var key = keyList[i];
var prop = obj[key];
var stringifyValue = 'null';
<?php
$log = shell_exec('git log');
preg_match('/commit\s(.*+)/', $log, $result);
$lastedCommit = $result[1];
preg_match('/commit\s(.*+)\nMerge/', $log, $result);
$startCommit = $result[1];
@marlonfan
marlonfan / php-code-snippit.php
Last active October 14, 2017 07:30
php常用代码片段
<?php
/**
* 给一个数组,将他填充到指定长度
* @param array $arr
* @param number $needNumber
* @return array
* @author marlon marlon@tfan.net
*/
function padArray($array, $needNumber)
{
@marlonfan
marlonfan / serve-thinkphp.sh
Created March 6, 2017 16:49 — forked from angusty/serve-thinkphp.sh
laravel/homestead的thinkphp的nginx脚本,使用方法: homestead/scripts 里建一个serve-thinkphp.sh文件,拷贝以下代码。Homestead.yaml配置项的sites添加type:thinkphp
#!/usr/bin/env bash
mkdir /etc/nginx/ssl 2>/dev/null
openssl genrsa -out "/etc/nginx/ssl/$1.key" 1024 2>/dev/null
openssl req -new -key /etc/nginx/ssl/$1.key -out /etc/nginx/ssl/$1.csr -subj "/CN=$1/O=Vagrant/C=UK" 2>/dev/null
openssl x509 -req -days 365 -in /etc/nginx/ssl/$1.csr -signkey /etc/nginx/ssl/$1.key -out /etc/nginx/ssl/$1.crt 2>/dev/null
block="server {
listen ${3:-80};
listen ${4:-443} ssl;
@marlonfan
marlonfan / Install-php7.md
Created April 1, 2017 16:45 — forked from hollodotme/Install-php7.md
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@marlonfan
marlonfan / Laravel PHP7 LEMP AWS.md
Created June 14, 2017 14:59 — forked from santoshachari/Laravel PHP7 LEMP AWS.md
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.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
@marlonfan
marlonfan / des.go
Last active August 21, 2017 04:48 — forked from cuixin/des.go
des ecb mode in golang
package main
import (
"bytes"
"crypto/cipher"
"crypto/des"
"encoding/base64"
"fmt"
)
{
"bootstrapped": true,
"http_proxy": "127.0.0.1:1087",
"in_process_packages":
[
],
"installed_packages":
[
"A File Icon",
"Alignment",
@marlonfan
marlonfan / launch.json
Created October 20, 2017 05:47
vscode debug's config
{
"version": "0.2.0",
"configurations": [{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9009,
"localSourceRoot": "${workspaceRoot}/public",
"serverSourceRoot": "/home/vagrant/Code/forzu-be/public"
},