Skip to content

Instantly share code, notes, and snippets.

View adrianorsouza's full-sized avatar
🏠
Working from home

Adriano Rosa adrianorsouza

🏠
Working from home
View GitHub Profile
@adrianorsouza
adrianorsouza / js-random-string.js
Created May 11, 2015 19:43
Create random string with Javascript
Math.floor(Math.random()*0xFFFFFFFFFFFFFFFF).toString(36);
@adrianorsouza
adrianorsouza / renames.sh
Created May 5, 2015 17:04
Rename list of files within a given directory
#!/bin/bash
# @autor: Adriano Rosa <http://adrianorosa.com>
# @file: renames.sh
# @description: basic file renamer
# @usage: ./renames.sh path/ .html .php
criteria=$1
re_match=$2
replace=$3
if [[ $criteria && $re_match && $replace ]]; then
@adrianorsouza
adrianorsouza / jQuery.scrollToElement.js
Last active August 29, 2015 14:08
jQuery scrollTo element effect
$("body,html").animate({
scrollTop : (
$('div.element:last').offset().top // get the offset of the last element to scrollTo
- $('header.navbar').outerHeight() // get the difference whether there is fixed header element
+ $('div.element:last').outerHeight() // get the element itself height to make scroolTo be exact under the fixed header
)
},1500);
diff --git a/developer/js/module-shorten.js b/developer/js/module-shorten.js
index df2e8f8..71f8965 100644
--- a/developer/js/module-shorten.js
+++ b/developer/js/module-shorten.js
@@ -32,6 +32,11 @@
return;
}
+ // Skip whether the window is shorten_hash
+ if ( el === 'user' && hash ) {
@adrianorsouza
adrianorsouza / sublime-command-line.md
Last active September 26, 2023 16:26
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

# BUILD PHP 5.5.15 on Mac OSX 10.9 (A.K.A Mavericks)
# @author Adriano Rosa (http://adrianorosa.com)
# date 2014-08-05 23:58
#
# References:
# http://stackoverflow.com/questions/22686284/os-x-mavericks-how-to-upgrade-php-5-4-to-5-5-latest
# http://php.net/manual/en/mssql.requirements.php
# http://stackoverflow.com/questions/6588174/enabling-postgresql-support-in-php-on-mac-os-x
# https://bugs.php.net/bug.php?id=41555
# http://xdebug.org/docs/install
@adrianorsouza
adrianorsouza / mkselfssl.sh
Last active September 1, 2023 10:34
Script to create a new self-signed SSL Certificate for Nginx
#!/bin/bash
# @author Adriano Rosa (http://adrianorosa.com)
# @date: 2014-05-13 09:43
#
# Bash Script to create a new self-signed SSL Certificate
# At the end of creating a new Certificate this script will output a few lines
# to be copied and placed into NGINX site conf
#
# USAGE: this command will ask for the certificate name and number in days it will expire
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@adrianorsouza
adrianorsouza / Default (OSX).sublime-keymap
Last active April 24, 2017 07:53 — forked from uberbuilder/Default (OSX).sublime-keymap
Create a Date Time Stamp in Sublime Text 2 on a Mac
[
{"keys": ["alt+s"], "command": "add_date_time_stamp" },
{"keys": ["alt+d"], "command": "add_date_stamp" },
{"keys": ["alt+t"], "command": "add_time_stamp" }
]
@adrianorsouza
adrianorsouza / X-header-options
Last active August 29, 2015 13:59
X-header Options
X-Content-Type-Options:nosniff
X-Frame-Options:(deny|sameorigin)
X-XSS-Protection:1; mode=block
# For SSL
Strict-Transport-Security: max-age=16070400; includeSubDomains
# for images
X-Robots-Tag:noindex, nofollow