Skip to content

Instantly share code, notes, and snippets.

@alfchee
alfchee / NumeroALetras.js
Last active March 30, 2024 12:13
Código en JavaScript que convierte números a letras, bastante útil para formularios de documentos contables y similares
/*************************************************************/
// NumeroALetras
// The MIT License (MIT)
//
// Copyright (c) 2015 Luis Alfredo Chee
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@alfchee
alfchee / git-prune.bash
Created May 3, 2021 16:43
Delete all merged branches in remote, excluding branches `dev` and `main`.
git branch --merged | egrep -v "(^\*|main|dev)" | xargs git branch -d
@alfchee
alfchee / CSSSlider.html
Created October 17, 2015 17:27
Demo of a Slider only with CSS3, nothing of JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Slider CSS</title>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if gte IE 9]>
@alfchee
alfchee / debugg_trace.php
Created October 26, 2018 16:43
Trace the stack of calls for your break var_dump()
// useful line of code to generate a backtrace
array_walk(debug_backtrace(),create_function('$a,$b','print "{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']}); ";')); die();
@alfchee
alfchee / TimelineComponent.js
Created September 7, 2018 16:01
Idea about time ranges solutions
import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
@Component({
selector: 'app-timeline',
templateUrl: './timeline.component.html',
styleUrls: ['./timeline.component.css']
})
export class TimelineComponent implements OnInit {
@alfchee
alfchee / redis-server
Created July 16, 2018 02:24 — forked from nexdrew/redis-server
Example files for running Redis on CentOS 7 (after manual install)
/var/lib/redis/logs/redis.log {
daily
rotate 14
copytruncate
delaycompress
compress
notifempty
missingok
}
@alfchee
alfchee / simplesaml.conf
Created July 14, 2018 18:18
Simple SAML PHP configuration, to incluse SimpleSAMLPHP as part of your domain.com/simplesaml
{
listen 80;
server_name mydomain.com;
location ^~ /simplesaml {
alias /var/simplesamlphp/www;
location ~ ^(?<prefix>/simplesaml)(?<phpfile>.+?\.php)(?<pathinfo>/.*)?$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
@alfchee
alfchee / install_redis_on_ubuntu.md
Created June 7, 2018 17:44 — forked from torgeir/install_redis_on_ubuntu.md
Redis 2.4.8 Install on Ubuntu 10.04

Installation commands:

$ wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz
$ tar xvfz redis-2.4.8.tar.gz 
$ cd redis-2.4.8/
$ mkdir -p /opt/redis
$ make PREFIX=/opt/redis install
$ cp redis.conf /opt/redis/redis.conf
$ chown -R redis:redis /opt/redis
@alfchee
alfchee / slice_exists.go
Created April 26, 2018 00:52 — forked from r6m/slice_exists.go
golang check if item exists in slice
package main
import(
"fmt"
"reflect"
)
func main() {
items := []int{1,2,3,4,5,6}
fmt.Println(SliceExists(items, 5)) // returns true
@alfchee
alfchee / remove-unused-branches.sh
Created November 27, 2017 16:19
This simple script will prune the removed branches on remote, list the branches that has a state of "gone" and then remove them
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d