Skip to content

Instantly share code, notes, and snippets.

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

Luis Pirir lpirir

🏠
Working from home
View GitHub Profile
@lpirir
lpirir / write_encoding.py
Created March 6, 2021 19:16 — forked from ionatan-israel/write_encoding.py
Cambiar codificación de caracteres de un archivo con python.
# -*- coding: utf-8 -*-
file = 'file.csv'
outfile = 'out.csv'
f = open(file, 'rb')
# Windows Comma Separated (.csv) ~ ISO-8859-2 | CP1252
content = unicode(f.read(), 'CP1252')
f.close()
@lpirir
lpirir / videoEmbed.js
Created October 12, 2020 05:55 — forked from bzerangue/videoEmbed.js
videoEmbed.js contentType - preview component for Sanity.io CMS richText PortableText editor - based off of Knut's YouTube Preview, https://www.youtube.com/watch?v=kLsER_zHiS4
import React from 'react'
const VideoEmbedPreview = ({ value }) => {
const url = value.url
const responsiveVideoContainer = {
padding: "56.25% 0 0 0",
position: "relative"
}
@lpirir
lpirir / user-profile-picture.php
Created October 8, 2020 00:00 — forked from spigotdesign/user-profile-picture.php
Add WordPress image uploader to user profile.
/*
* Add custom user profile information
*
*/
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?>
@lpirir
lpirir / init.el
Created September 14, 2020 06:01 — forked from soonhokong/init.el
Emacs Configuration for Windows
;; Package
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
(package-refresh-contents)
;; Install required/optional packages for lean-mode
(defvar lean-mode-required-packages
'(company dash dash-functional flycheck whitespace-cleanup-mode
@lpirir
lpirir / init.el
Created September 14, 2020 05:39 — forked from tado/init.el
init.el for Emacs on Windows 10
;; package
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
;; basic settings
(set-language-environment 'utf-8)
@lpirir
lpirir / init.vim
Created September 11, 2020 04:16 — forked from benawad/init.vim
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
"Plug 'tsony-tsonev/nerdtree-git-plugin'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
<?php namespace App\Console\Commands;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
class KeyGenerateCommand extends Command
{
/**
* The console command name.
@lpirir
lpirir / __init__.py
Last active August 29, 2015 14:15 — forked from jhargis/__init__.py
# -*- coding: utf-8 -*-
# http://docs.cherrypy.org/en/latest/advanced.html?highlight=jinja2#html-templating-support
import os.path
import cherrypy
class Root(object):
@cherrypy.expose
def index(self):
@lpirir
lpirir / .vimrc
Created December 23, 2013 18:59 — forked from JeffreyWay/.vimrc
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
@lpirir
lpirir / relative-date-php
Created February 22, 2012 17:23 — forked from ivanmendoza/relative-date-php
Get relative date (spanish)
// INPUT: $item_date
$item_date = date("D, d M o G:i:s T",strtotime($item_date));
$today = date(DATE_RFC822);
$diff_date=(strtotime($today) - strtotime($item_date));
$inMinutes=round($diff_date/60);
$inHours=round($diff_date/(60*60));
$inDays=round($diff_date/(24*60*60));
if($inMinutes==1){$txt_date="hace un minuto";}