Skip to content

Instantly share code, notes, and snippets.

View carlohcs's full-sized avatar
🎯
Focusing on my Postgraduate degree!

Carlos Santana carlohcs

🎯
Focusing on my Postgraduate degree!
View GitHub Profile
@carlohcs
carlohcs / .htaccess
Created June 21, 2016 03:50 — forked from THEtheChad/.htaccess
Access-Control-Allow-Origin for Subdomains
SetEnvIf Origin "^(.*\.example\.com)$" ORIGIN_SUB_DOMAIN=$1
Header set Access-Control-Allow-Origin "%{ORIGIN_SUB_DOMAIN}e" env=ORIGIN_SUB_DOMAIN
@carlohcs
carlohcs / slug.js
Created July 2, 2016 13:29
A helpert to create a basic slug from some string.
(function(namespace, Handlebars) {
/**
* Retorna uma string no formato "uma-texto-a-ser-formatado"
*
* @param {String} text
* @param {Sttring} separador
* @return {String}
*/
function slug(text, separator) {
var
@carlohcs
carlohcs / git-custom-log.txt
Last active April 12, 2019 14:20
Provide a better git custom log view
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
git config --global alias.st "status -sb"
git config --global alias.co "checkout"
git config --global alias.cm = "commit"
git config --global alias.ac = "!git add -A && git commit"
git config --global alias.st "status -sb"
git config --global alias.tags "tag -l"
git config --global alias.branches "branch -a"
git config --global alias.remotes "remote -v"
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == "http") {
if(!headers_sent()) {
header("Status: 301 Moved Permanently");
header(sprintf(
'Location: https://%s%s',
$_SERVER['HTTP_HOST'],
$_SERVER['REQUEST_URI']
));
exit();
}
@carlohcs
carlohcs / copia-chave-ssh-para-servidor.md
Last active January 5, 2017 16:31
Como copiar chave ssh para servidor
@carlohcs
carlohcs / import-once-workaround.scss
Created January 11, 2017 21:35 — forked from paulwellnerbou/import-once-workaround.scss
Function for SASS/SCSS to avoid duplicate imports and redundant generated CSS. See http://paul.wellnerbou.de/2015/05/18/avoid-multiple-imports-of-the-same-scss-file-with-sass/ for more details.
/* If this function is imported, you can import scss files using:
@if not-imported("your-file") { @import "your-file"; }
*/
$imported-once-files: () !default;
@function not-imported($name) {
$imported-once-files: $imported-once-files !global;
$module_index: index($imported-once-files, $name);
@if (($module_index == null) or ($module_index == false)) {
@carlohcs
carlohcs / apache_app.conf
Created January 14, 2017 12:47
Permite apache responder por pastas com .well-known (com .)
# Reconhecimento de arquivos ssl
<Directory /app/web/public/.well-known>
Options +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
@carlohcs
carlohcs / jekyll-and-liquid.md
Created January 16, 2017 17:30 — forked from magicznyleszek/jekyll-and-liquid.md
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

svn log | perl -l40pe 's/^-+/\n/'
@carlohcs
carlohcs / node_wrapper.md
Created January 31, 2017 17:00 — forked from cstipkovic/node_wrapper.md
NodeJS wrapper for run locally using binary

NodeJS Wrapper - run binary locally

Node.js wrapper which will download and proxy to node locally. This allows you to automatically manage the installed version of node.

CONFIGURATION

NODEW_INSTALL_VERSION - an env variable to specify the version of node to install - Defaults to 4.4.7 NODEW_DIST_BASE_URL - an env variable to specify the binary download location - Defaults to NodeJS website