Skip to content

Instantly share code, notes, and snippets.

View genediazjr's full-sized avatar
🎱
foobar

Gene Diaz genediazjr

🎱
foobar
View GitHub Profile
@genediazjr
genediazjr / SerializeObject.js
Last active December 31, 2015 11:59
prepare form objects for JSON.stringify
$.fn.serializeObject = function () {
var o = {};
var a = this.serializeArray();
$.each(a, function () {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
@genediazjr
genediazjr / Add-CORS-Filter-to-Spring Maven.xml
Last active June 19, 2020 09:53
Add CORS Filter to Spring Maven
<!-- Append to pom.xml -->
<dependency>
<groupId>com.thetransactioncompany</groupId>
<artifactId>cors-filter</artifactId>
<version>1.8</version>
</dependency>
<!-- Append to web.xml -->
<filter>
@genediazjr
genediazjr / yyyyMMddHHmmssSSS_Timestamp.js
Last active December 31, 2015 11:59
A simple yyyyMMddHHmmssSSS timestamp generator
function getTimestamp () {
var date = new Date();
var year = date.getFullYear();
var month = (date.getMonth() + 1) + '';
var day = date.getDate() + '';
var hr = date.getHours() + '';
var min = date.getMinutes() + '';
var sec = date.getSeconds() + '';
var ms = date.getMilliseconds() + '';
@genediazjr
genediazjr / .gitignore
Last active December 31, 2015 11:59
Gitignore Preset
.DS_Store
.lock-wscript
.komodotools
.classpath
.settings
.project
.dropbox
.tmproj
.grunt
.cache
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
};
function guid() {
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
}
@genediazjr
genediazjr / deploy.sh
Last active December 31, 2015 16:29
Tomcat deployment script on Debian EC2
#!/bin/sh
echo "\n Killing the cat..."
/etc/init.d/tomcat7 stop
echo "\n Removing internal organs..."
rm -rf /var/lib/tomcat7/webapps/ROOT
rm -rf /var/lib/tomcat7/webapps/ROOT.war
echo "\n Placing new organs..."
.text-shadow (@string: 0 1px 3px rgba(0, 0, 0, 0.25)) {
text-shadow: @string;
}
.box-shadow (@string) {
-webkit-box-shadow: @string;
-moz-box-shadow: @string;
box-shadow: @string;
}
@genediazjr
genediazjr / debian-nginx-php.sh
Last active November 11, 2015 06:11
Nginx w/ PHP on Debian
apt-get install vim nginx php5-fpm php5-xcache
php5-sqlite sqlite3
php5-mysql mysql-server mysql-client
vim /etc/nginx/nginx.conf
-----------------------------------------------------------------------------
server_tokens off;
-----------------------------------------------------------------------------
@genediazjr
genediazjr / debian-nodejs.sh
Last active November 11, 2015 06:10
Nodejs on Debian
apt-get install vim python g++ make checkinstall
src=$(mktemp -d) && cd $src
wget -N http://nodejs.org/dist/node-latest.tar.gz
tar xzvf node-latest.tar.gz && cd node-v*
./configure
@genediazjr
genediazjr / debian-redis.sh
Last active November 11, 2015 06:07
Redis on Debian
apt-get install vim redis-server
vim /etc/redis/redis.conf
-----------------------------------------------------------------------------
bind 0.0.0.0
-----------------------------------------------------------------------------
appendonly yes
-----------------------------------------------------------------------------
vim /etc/sysctl.conf