Skip to content

Instantly share code, notes, and snippets.

View tucq88's full-sized avatar
🎯
Fake it till you make it. Confidence is more important than knowledge.

Tu Chu tucq88

🎯
Fake it till you make it. Confidence is more important than knowledge.
View GitHub Profile
<?php
public function routeClass()
{
$routeArray = Str::parseCallback(Route::currentRouteAction(), null);
if (last($routeArray) != null) {
// Remove 'controller' from the controller name.
$controller = str_replace('Controller', '', class_basename(head($routeArray)));
$fplog = fopen("logb.txt", "a+");
$lastlogtime = time();
function log_time($logtext)
{
global $fplog, $lastlogtime;
$nowtime = time();
$diff = $nowtime - $lastlogtime;
fwrite($fplog, sprintf("%-30s | %-30s | %-3d", $logtext, date('F Y h:i:s A', $nowtime), $diff) . PHP_EOL);
@tucq88
tucq88 / vim74centos
Last active August 29, 2015 14:27 — forked from juxtin/vim74centos
Compile Vim 7.4 on Centos and install my vimrc
#!/bin/bash
yum groupinstall 'Development tools' -y
yum install ncurses ncurses-devel wget git -y
cd /usr/local/src
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar -xjf vim-7.4.tar.bz2
cd vim74
./configure --prefix=/usr --with-features=huge --enable-rubyinterp --enable-pythoninterp
make && make install
@tucq88
tucq88 / .extra
Last active October 31, 2015 16:56
my-dotfiles
# Shortcut Navigation
alias go-project="cd ~/Projects"
# Shortcut SSH
alias remote-offspring="ssh offspri1@offspringdigital.com"
alias remote-lamp-aws="ssh -i ~/Documents/lamp-server.pem ec2-user@52.64.104.76"
alias remote-vps="ssh tucq@128.199.179.134"
# Function
shopt -s cdspell
@tucq88
tucq88 / curl-resume.sh
Created December 8, 2015 17:42
Resume CURL
# Copied from http://ngtuna.blogspot.com/2013/12/download-continuously-with-curl.html
#! /bin/bash
export done=1;
while [ $done -gt 0 ]; do
/usr/bin/curl -O -C - $1;
export done=$?;
done
if [ $done -eq 0 ]; then
@tucq88
tucq88 / .00 | dotfiles_server
Last active May 8, 2017 07:35
Dotfiles for server
.bash_rc
.inputrc
.gitconfig
@tucq88
tucq88 / better-ternary
Created April 25, 2016 10:37
Better ternary
x = (y < 100) ? "dog" :
(y < 150) ? "cat" :
(y < 300) ? "bar" : "baz";
@tucq88
tucq88 / ISC.md
Created May 17, 2016 03:55 — forked from indexzero/ISC.md
ISC vs. MIT

Copyright (c) 4-digit year, Company or Person's Name

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Source: http://opensource.org/licenses/ISC

@tucq88
tucq88 / capitallize.js
Last active May 27, 2016 08:20
AngularJS | Directive | Capitalize first word or make first char uppercase
app.directive('capitalize', function($parse) {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, element, attr, ngModel) {
//Process input + return processed value
var capitalize = function(inputValue) {
if (inputValue) {
//Capitalize first word
@tucq88
tucq88 / api.md
Last active July 7, 2016 04:04
API - the right way
  • response
  • Transform output