Skip to content

Instantly share code, notes, and snippets.

View greyaperez's full-sized avatar

Grey Perez greyaperez

View GitHub Profile
@greyaperez
greyaperez / run_in_background.sh
Created December 3, 2013 20:55
Run Process in Background
nohup ant run > output.log 2>&1 &
@greyaperez
greyaperez / grep_by_ext.sh
Created November 27, 2013 20:35
Grep only in files of a certain Extension in current path.
grep -roi --include *.ext something .
@greyaperez
greyaperez / REST_endpoint.php
Created November 27, 2013 19:37
Just point your REST call to this file and it will store it to a file. Just change $file to whatever file you would like, currently set to request.json. Also remember to chmod that file so it's writable.
<?php
header("Access-Control-Allow-Orgin: *");
header("Access-Control-Allow-Methods: *");
header("Content-Type: application/json");
$requestData = '';
if(isset($HTTP_RAW_POST_DATA) && strlen($HTTP_RAW_POST_DATA) > 0){
@greyaperez
greyaperez / whoisport.sh
Created November 13, 2013 19:43
What App is using a specific port. Both linux and cygwin versions included.
# LINUX (TODO)
function whoisport (){
port=$1
pidInfo=$(fuser $port/tcp 2> /dev/null)
pid=$(echo $pidInfo | cut -d':' -f2)
ls -l /proc/$pid/exe
}
# CYGWIN
function whoisport (){
@greyaperez
greyaperez / ZFTool
Created November 10, 2013 19:26
ZFTool Usage Reference (ZendFramework 2)
Top 5 Most Important
===================
# zf show help screen
# zf modules show loaded modules
# zf create module <name> [<path>]
# zf create controller <name> <module> [<path>]
# zf create action <name> <controller> <module> [<path>]
Basic information
@greyaperez
greyaperez / IDE Shortcuts
Created November 8, 2013 19:03
Netbeans + Eclipse + IntelliJ / WebStorm : Important Shortcut Keys
# Note if OSX (replace ctrl with cmd key) #
Netbeans
=================
Open Type (Class) - ctrl + o
Find File - alt + Shift + o
Code Suggestions - alt + Enter
Eclipse
@greyaperez
greyaperez / unset_function.sh
Created October 17, 2013 14:46
Remove Unused Function Alias. Important after renaming or removing a function in your .bashrc file.
unset -f my_function
@greyaperez
greyaperez / zftool.sh
Created October 17, 2013 14:26
Zend Framework 2 - ZFTool. Auto-installs itself in ZF2 root dirs. Also provides easier usage.
function zftool (){
if [ ! -f $PWD/vendor/zendframework/zftool/zf.php ] && [ -d ./vendor/ ];
then
echo "ZFTool Not Found, I will Auto-Install ZFTool for You. Please Wait..."
sudo composer require zendframework/zftool:dev-master;
sleep 8
elif [ ! -d ./vendor/ ];
then
echo "You are not in a Zend Framework 2 Root"
return 0;
@greyaperez
greyaperez / input_num_only.js
Created September 30, 2013 15:16
Clears Non-Numeric Chars with Each Keystroke
// FN Input Numbers Only
$.fn.inputNumOnly = function(){
$(this).each(function(){
$this = $(this);
$this.keyup(function(){
var fieldVal = $this.val();
if(fieldVal.search(/[^0-9?]/gi) > -1){ $this.val(fieldVal.replace(/[^0-9?]/gi,"")); }
});
return this;
});
@greyaperez
greyaperez / mysql-date-format.php
Created September 26, 2013 17:11
Get Date in MySQL Date format.
date('Y-m-d H:i:s');