Skip to content

Instantly share code, notes, and snippets.

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

Juan Carlos Pulido S alephart

🏠
Working from home
View GitHub Profile
@alephart
alephart / main.jsx
Last active July 5, 2016 04:37
Meteor con React
import React from 'react';
import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';
class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {count: props.initialCount};
this.tick = this.tick.bind(this);
}
@alephart
alephart / main.js
Created July 5, 2016 04:36
Meteor con Blaze
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import './main.html';
Template.hello.onCreated(function helloOnCreated() {
// counter starts at 0
this.counter = new ReactiveVar(0);
});
@alephart
alephart / slugify.php
Last active August 29, 2018 04:09
Slugify es la acción de pasar una cadena de texto a una URL valida (un slug, como en wordpress). Aquí un función PHP para esta acción.
// Slugify a string
// taken from https://www.lucidar.me/en/web-dev/how-to-slugify-a-string-in-php/
function slugify($text)
{
// Strip html tags
$text=strip_tags($text);
// Replace non letter or digits by -
$text = preg_replace('~[^\pL\d]+~u', '-', $text);
// Transliterate
setlocale(LC_ALL, 'en_US.utf8');
@alephart
alephart / slugify.js
Last active August 29, 2018 04:08
Slugify es la acción de pasar una cadena de texto a una URL valida (un slug, como en wordpress). Aquí un función Javascript para esta acción.
// Slugify a string
// taken from https://www.lucidar.me/en/web-dev/how-to-slugify-a-string-in-javascript/
function slugify(str)
{
str = str.replace(/^\s+|\s+$/g, '');
// Make the string lowercase
str = str.toLowerCase();
@alephart
alephart / .hyper.js
Last active December 11, 2018 01:40
Config Hyper with opacity in windows (with git bash)
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@alephart
alephart / orderby_date.js
Last active October 3, 2020 04:43
orderBy date with javascript, moment and lodash
// require moment and lodash
import moment from 'moment';
import _ from 'lodash';
// Option 1
function sortByDate(array, element) {
const sortedArray = array.sort((a, b) => moment(a[element]).diff(moment(b[element])));
return sortedArray;
}
@alephart
alephart / wordpress-valet-install.md
Created January 7, 2021 12:54 — forked from orumad/wordpress-valet-install.md
How to install Wordpress from command line in Valet

How to install Wordpress from command line in Valet

I use Valet as my local web development environment (PHP, Laravel, Wordpress, ...)

This gist is my own recipe to install Wordpress from the command line to use it with Valet. Maybe this is useful for you too.

Install 'WP-CLI' command line tool

@alephart
alephart / ffmpeg-install.sh
Created February 11, 2021 20:50 — forked from clayton/ffmpeg-install.sh
Install FFMPEG on OS X with HomeBrew to convert Mp4 to WebM
# Installation
brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid
# Easy Peasy
ffmpeg -i video.mp4 video.webm
@alephart
alephart / install_ffmpeg.sh
Created February 11, 2021 20:51 — forked from Piasy/install_ffmpeg.sh
brew install ffmpeg with all options
brew options ffmpeg
brew install ffmpeg \
--with-chromaprint \
--with-fdk-aac \
--with-fontconfig \
--with-freetype \
--with-frei0r \
--with-game-music-emu \
--with-libass \
@alephart
alephart / ffmpeg-watermark.md
Created February 11, 2021 22:00 — forked from bennylope/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.