Skip to content

Instantly share code, notes, and snippets.

View juanpablocs's full-sized avatar
💭
👨‍💻 Coding..

Juan pablo juanpablocs

💭
👨‍💻 Coding..
View GitHub Profile
@juanpablocs
juanpablocs / ffmpeg.sh
Last active March 17, 2017 23:48
ffmpeg mp3 rename tag or bitrate on demand
#!/bin/bash
#rename id3 album
#output file with "_.mp3"
for file in myfolder/*.mp3; do
ffmpeg -i $file -acodec copy -metadata album="Mysite.CoM" "$( sed -e's/\.mp3/_.mp3/g' <<< $file )"
# convert to 128kbps
#ffmpeg -i $file -ab 128k "$( sed -e's/\.mp3/_.mp3/g' <<< $file )"
done
@juanpablocs
juanpablocs / webpack2.md
Last active March 31, 2017 19:39
Demo webpack2 integración de Sass y ES6 en español

Webpack 2

Aquí veremos un pequeño ejemplo de como usar webpack2 + babel + sass

instalar dependencias

instalamos dependencias básicas

npm install webpack@2.2.1 babel-core babel-preset-es2015 node-sass --save-dev
@juanpablocs
juanpablocs / error-503.php
Created April 3, 2017 21:47
error 503 maintenance correct for seo.
<?php
header( "{$_SERVER['SERVER_PROTOCOL']} 503 Service Unavailable", true, 503 );
header( "Retry-After: 3600" );
?>
<h1>In Maintenance</h1>
@juanpablocs
juanpablocs / cookie_facebook.sh
Created May 23, 2017 16:52
facebook curl cookie
@juanpablocs
juanpablocs / dir_execute_command.md
Last active October 16, 2017 17:41
access each folder that matches the regex

bash git pull each dir

Execute command:

git_current_branch () {
  #https://stackoverflow.com/a/35298459
  echo $(git branch | grep '^*' | sed 's/* //' )
}

Test promise

describe('unittest', () => {
    test('the data is peanut butter', () => {
        function fetchData(){
            return new Promise((resolve,reject)=>{
                resolve('peanut butter');
            });
        }
 expect.assertions(1);

task:

const fs = require('fs');
const param = process.env.page;
const webpackFile = './webpack.config.js';

const msgErr = (msg)=>{
	console.log(msg);
	process.exit();
}

Redux es un almacenador de estados

con redux nuestra aplicación puede trabajar con estados en un solo arbol de datos. Redux trabaja con unos cuantos métodos pero efectivos los cuales son

  • createStore
  • dispatch
  • getState
  • subscribe

un ejemplo básico:

@juanpablocs
juanpablocs / selenium-chrome.md
Last active February 21, 2018 22:44
Install and ready selenium driver for node.js (required node 7+)

Install Chrome driver

wget -N https://chromedriver.storage.googleapis.com/2.29/chromedriver_linux64.zip -P ~/
unzip ~/chromedriver_linux64.zip -d ~/
rm ~/chromedriver_linux64.zip

sudo mv -f ~/chromedriver /usr/local/bin/chromedriver
@juanpablocs
juanpablocs / docker-front.md
Last active February 23, 2018 21:22
run npm commands from client to docker

Docker and npm

My files

.
├── Dockerfile
└── src
    ├── package.json
    └── task.js