Skip to content

Instantly share code, notes, and snippets.

View fdorantesm's full-sized avatar

Fernando Dorantes fdorantesm

View GitHub Profile
@fdorantesm
fdorantesm / docker-compose.yml
Last active February 20, 2023 07:52
Minio docker container using docker compose
version: '3.8'
services:
minio:
image: minio/minio:latest
container_name: minio
restart: always
command: server --console-address :9001 /data
environment:
- MINIO_ROOT_USER=AKIAIOSFODNN7EXAMPLE
@fdorantesm
fdorantesm / bullet-train.zsh-theme
Created February 17, 2023 05:44
Bullet train showing language version if directory contains language's files.
# README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
# In addition, I recommend the
# [Tomorrow Night theme](https://github.com/chriskempson/tomorrow-theme) and, if
# you're using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over
# Terminal.app - it has significantly better color fidelity.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fdorantesm
fdorantesm / sessions.php
Created February 22, 2018 22:29
PHPSESSID Helper functions
<?php
function decode_session($data){
$temp = $_SESSION;
session_decode($data);
$out = $_SESSION;
$_SESSION = $temp;
return $out;
}
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
@fdorantesm
fdorantesm / helpers.php
Created February 9, 2018 17:10
Human implode
<?php
function human_implode($glue = ",", $last = "y", $elements = array(), $filter = null){
if ($filter) {
$elements = array_map($filter, $elements);
}
$str = implode("{$glue} ", $elements);
/**
* SELECT * FROM users LIMIT 20
limit = 10
page?=1
offset = (page - 1) * limit
LIMIT offset,limit
function arrayPaginate(array, page_size, page_number) {
--page_number; // because pages logically start with 1, but technically with 0
return array.slice(page_number * page_size, (page_number + 1) * page_size);
}
@fdorantesm
fdorantesm / readcfdi.php
Created June 11, 2020 23:35 — forked from goedecke/readcfdi.php
Extraer información de CFDI XML facil con simplexml
<?php
$xml = simplexml_load_file('test.xml');
$ns = $xml->getNamespaces(true);
$xml->registerXPathNamespace('c', $ns['cfdi']);
$xml->registerXPathNamespace('t', $ns['tfd']);
//EMPIEZO A LEER LA INFORMACION DEL CFDI E IMPRIMIRLA
foreach ($xml->xpath('//cfdi:Comprobante') as $cfdiComprobante){
echo $cfdiComprobante['version'];