This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $file = 'hola.jpg'; | |
| echo substr($file, strrpos($file, '.')); | |
| function canonicalize($input) | |
| { | |
| return strtolower(preg_replace('/[^\w -]/', '', iconv('UTF-8', 'ASCII//TRANSLIT', $input))); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rsync -ah --progress source-file destination |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| function jwt_hs256 { | |
| SECRET="$1" | |
| DATA="$2" | |
| HEADER=`echo -n '{"alg":"HS256","typ":"JWT"}' | base64` | |
| PAYLOAD=`echo -n $DATA | base64` | |
| UNSIGNED_TOKEN="${HEADER}.${PAYLOAD}" | |
| SIGNATURE=`echo -n "${UNSIGNED_TOKEN}" | openssl dgst -sha256 -hmac "${SECRET}" -binary | base64 | sed -e 's/=//g' | sed -e 's/+/-/g' | sed -e 's/\//_/g'` | |
| echo "${HEADER}.${PAYLOAD}.${SIGNATURE}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Base editorconfig for new projects | |
| root = true | |
| [*] | |
| end_of_line = lf | |
| indent_style = space | |
| tab_width = 4 | |
| charset = utf-8 | |
| trim_trailing_whitespace = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;(function (global) { | |
| var DraggableElement = function (parent, el) { | |
| el.setAttribute('draggable', true); | |
| el.addEventListener('dragstart', onDragStart, false); | |
| parent.addEventListener('dragover', onDragOver, false); | |
| parent.addEventListener('drop', onDropFactory(el), false); | |
| }; | |
| function onDragStart(e) { | |
| var style = global.getComputedStyle(e.target, null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do | |
| git branch --track ${branch#remotes/origin/} $branch | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django import template | |
| from django.template.defaultfilters import linebreaksbr | |
| from django.utils.html import escape | |
| try: | |
| from django.utils.safestring import mark_safe | |
| except ImportError: # v0.96 and 0.97-pre-autoescaping compat | |
| def mark_safe(x): return x | |
| from pprint import pformat | |
| def rawdump(x): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from __future__ import print_function, generators | |
| import os | |
| import time | |
| import threading | |
| import multiprocessing | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin sh | |
| # This hook is sourced after every virtualenv is activated. | |
| # PROJECT_HOME is defined in your envrironment with folder for save your projects | |
| # example (add to your .bashrc or .zshrc): | |
| # export PROJECT_HOME="${HOME}/Projects" | |
| PROJECT_NAME=$(basename "$VIRTUAL_ENV") | |
| cd "${PROJECT_HOME}/${PROJECT_NAME}" |