Skip to content

Instantly share code, notes, and snippets.

@shrekuu
shrekuu / .zshrc-for-mac-with-php5.6.sh
Last active June 15, 2017 02:51
.zshrc for macOS Sierra with system php5.6 and system apache2
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
# Thanks to this post:
# http://blog.ikato.com/post/15675823000/how-to-install-consolas-font-on-mac-os-x
$ brew install cabextract
$ cd ~/Downloads
$ mkdir consolas
$ cd consolas
$ curl -O http://download.microsoft.com/download/f/5/a/f5a3df76-d856-4a61-a6bd-722f52a5be26/PowerPointViewer.exe
$ cabextract PowerPointViewer.exe
$ cabextract ppviewer.cab
@shrekuu
shrekuu / back-button-event-handler.ts
Last active March 13, 2018 13:40
ionic 2 double press back button to exit app
// Note: I ended up using a service to quickly regiser and unregister the event when users navigate through pages.
// Please read before using.
import { Injectable } from '@angular/core';
import { Events, Platform } from "ionic-angular";
import { ToastControllerProvider } from "../toast-controller/toast-controller";
@Injectable()
export class BackButtonEventHandlerProvider {
@shrekuu
shrekuu / gradient.js
Last active May 11, 2017 10:21 — forked from siamak/gradient.js
Steps in Gradient
/**
* GradientArray • Steps gradient.
* @author Siamak Mokhtari <hi@siamak.work>
* @date 06/21/16.
*/
class GradientArray {
// Convert a hex color to an RGB array e.g. [r,g,b]
// Accepts the following formats: FFF, FFFFFF, #FFF, #FFFFFF
hexToRgb(hex) {
let r, g, b, parts;
@shrekuu
shrekuu / form.html
Created May 11, 2017 10:27 — forked from siamak/form.html
Image Validator (Dimension) with javascript.
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<h3>Image Validator: </h3>
@shrekuu
shrekuu / fix-fouc.md
Last active May 12, 2017 02:55
Fix FoUC. Show the 'hidden' elements at next tick.

Put these code in your app.

<style>
.fix-fouc {
  opacity: 0;
  /* use this one if you need more compatibility */
  /* display: none;  */
}
</style>
@shrekuu
shrekuu / image-preview-modal-page.ts
Created May 27, 2017 02:49
Ionic image preview modal(NOT working), tried to add zooming
import {Component, ElementRef, ViewChild} from '@angular/core';
import {NavController, NavParams, ViewController} from 'ionic-angular';
@Component({
selector: 'page-image-preview-modal',
templateUrl: 'image-preview-modal.html',
})
export class ImagePreviewModalPage {
@ViewChild('myImg') myImg:ElementRef;
@shrekuu
shrekuu / default
Created September 19, 2017 05:51 — 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;
}
@shrekuu
shrekuu / example.conf
Last active October 27, 2017 07:57
nginx server config example
server {
listen 80;
index index.php index.html index.htm;
root /var/www/example/public/;
server_name example.com;
location ^~ /api {
try_files $uri /index.php?$query_string;
}
@shrekuu
shrekuu / ubuntu14-sever-configuration-procedure.md
Last active October 27, 2017 07:56
ubuntu-14-server-configuration-procedure 2017