Skip to content

Instantly share code, notes, and snippets.

View juanghurtado's full-sized avatar
🙄

Juan G. Hurtado juanghurtado

🙄
View GitHub Profile
@juanghurtado
juanghurtado / process-downloads.sh
Last active April 19, 2016 15:14
Process tv shows and films download folders to move them to right Kodi folder (uses .sh scripts in previous gists)
find /storage/downloads/tvshows -type f \( ! -iname "*.part|.*" \) -exec /storage/move-tvshow-leaving-symlink-behind.sh {} \;
find /storage/downloads/films -type f \( ! -iname "*.part|.*" \) -exec /storage/move-film-leaving-symlink-behind.sh {} \;
@juanghurtado
juanghurtado / move-film-leaving-symlink-behind.sh
Last active February 24, 2016 09:47
Move a film file, leaving a symlink behind. Example: "Sample film (1992) [garbage text].mkv" to "$TARGET_FOLDER/Sample film (1992).mkv"
@juanghurtado
juanghurtado / move-tvshow-leaving-symlink-behind.sh
Last active February 24, 2016 09:47
Move a TV show file, leaving a symlink behind. Example: "Sample tv show 5x14 [garbage text].mkv" to "$TARGET_FOLDER/Sample tv show/Temporada 5/Sample tv show - 5x14.mkv"
@juanghurtado
juanghurtado / AbstractMultiselectToDTOConverter.java
Last active August 29, 2015 14:16
Vaadin multiselect OptionGroup and BeanFieldGroup
public class AbstractMultiSelectToDTOConverter implements Converter<Object, List<BaseDTO>> {
private static final long serialVersionUID = -7589634171531062832L;
private BeanContainer<Long, BaseDTO> container;
private final static List<BaseDTO> MODEL_TYPE_INSTANCE = new ArrayList<BaseDTO>();
@SuppressWarnings("unchecked")
public AbstractMultiSelectToDTOConverter(AbstractSelect field) {
this.container = (BeanContainer<Long, BaseDTO>) field.getContainerDataSource();
@juanghurtado
juanghurtado / practical-git.md
Last active June 30, 2022 09:54
Git práctico

Git práctico

Conceptos clave

Antes de empezar a soltar comandos como un bellaco, hay que explicar los conceptos clave que se necesitan conocer para trabajar con Git.

Comenzaremos con los diferentes estadios en los que puede encontrarse nuestro código (nuestros cambios sobre el contenido de los ficheros, en realidad).

  1. Workspace: Es el estado real de nuestros ficheros. Tal y como los vemos en nuestro editor.
  2. Stage: Aquí se encuentran los cambios sobre nuestros ficheros que se incluirán en el próximo commit. Cuando hacemos un git add, un git rm o un git mv, estamos introduciendo cambios en el stage, indicándole a Git que en el próximo commit esos cambios irán incluidos.

Keybase proof

I hereby claim:

  • I am juanghurtado on github.
  • I am juanghurtado (https://keybase.io/juanghurtado) on keybase.
  • I have a public key whose fingerprint is 5176 551A D7EA 2EBE 68C9 A0D2 E9E3 CD06 521F 3A41

To claim this, I am signing this object:

it "triggers 'error' event on Device API error", (done) ->
mockDeviceStorageThrowingError()
certs = Bus.reqres.request "entities:certificates"
certs.on "error", ->
expect(1).to.equal 1
done()
@juanghurtado
juanghurtado / device-storage.coffee
Created January 9, 2014 09:33
Mock Firefox OS Device Storage API. Note that now we only mock enumerate() method here.
# -----------------------------------------------------------------------------
# UTILS
# -----------------------------------------------------------------------------
convertBase64ToBinary = (base64) ->
raw = window.atob base64
rawLength = raw.length
array = new Uint8Array(new ArrayBuffer(rawLength))
i = 0
while i < rawLength
define [
'modules/main/views/general-view'
'app.framework'
'communication-bus'
], (GeneralView, Framework, Bus) ->
# ----------------------------------------------------------------------------
# Class definition
# ----------------------------------------------------------------------------
class ShowController extends Framework.Controller