Skip to content

Instantly share code, notes, and snippets.

Avatar
😍
Processing request ...

Guillermo Álvarez guillermo

😍
Processing request ...
View GitHub Profile
@guillermo
guillermo / 0 Figma Keyboard Shortcuts for windows.md
Last active Apr 12, 2021
Figma keyboard shortcuts for windows cheat sheet
View 0 Figma Keyboard Shortcuts for windows.md
@guillermo
guillermo / svg2pdf.bash
Created Dec 1, 2020 — forked from s417-lama/svg2pdf.bash
Reliable way to convert an SVG file to a PDF file using headless Chrome
View svg2pdf.bash
#!/bin/bash
#
# Convert an SVG file to a PDF file by using headless Chrome.
#
if [ $# -ne 2 ]; then
echo "Usage: ./svg2pdf.bash input.svg output.pdf" 1>&2
exit 1
fi
@guillermo
guillermo / 1 - useMousePosition.js
Created May 9, 2019
React Hooks relative mouse position used in kalena.app https://blog.kalena.app/day-6/
View 1 - useMousePosition.js
// Inspired by
// https://github.com/rehooks/window-mouse-position/blob/master/index.js
import {useState,useEffect} from 'react'
export default function useMousePosition(){
let [mousePosition, setMousePosition] = useState([0,0])
function handleMouseMove(e) {
setMousePosition( [e.pageX, e.pageY] );
@guillermo
guillermo / 1 - userContext.js
Last active May 9, 2019
React Hooks and Context for user in Kalena.app http://blog.kalena.app/day-6
View 1 - userContext.js
// We create a context interface with a reducer
import React, {createContext, useContext, useReducer} from 'react'
export const UserContext = createContext();
export const UserProvider = ({reducer, initialState, children}) =>(
<UserContext.Provider value={useReducer(reducer,initialState)}>
{children}
</UserContext.Provider>
)
@guillermo
guillermo / life.js
Last active May 9, 2019
Get windows size inside the component.
View life.js
import React from 'react'
import Logo from '../Logo';
import Background from '../Background';
import Header from '../Header';
import Stats from '../Stats';
import Timeline from '../Timeline';
import useWindowSize from '../../effects/useWindowSize';
View cloud-config.yaml
#cloud-config
preserve_hostname: false
fqdn: blog.kalena.app
hostname: blog.kalena.app
package_update: true
package_upgrade: true
package_reboot_if_required: true
packages: ['docker.io', 'ntp','libcap2-bin']
resolv_conf:
View cloud-config.yaml
#cloud-config
preserve_hostname: false
fqdn: blog.kalena.app
hostname: blog.kalena.app
package_update: true
package_upgrade: true
package_reboot_if_required: true
packages: ['docker.io', 'ntp','libcap2-bin']
resolv_conf:
@guillermo
guillermo / verbs.go
Last active Dec 12, 2016
Package verbs provides a simple method to filter request method with the net/http ServeMux
View verbs.go
// Copyright 2015 Guillermo Alvarez. All rights reserved.
// Use of this source code is governed by standard BSD license.
/*
Package verbs provides a simple method to filter request method with the net/http ServeMux
func createUser(w http.ResponseWriter, r *http.Request) {
...
}
mux := http.NewServeMux()
View iosvalidation.rb
#!/usr/bin/env ruby
def trace(msg)
$stderr.puts msg
end
begin
require "rest"
rescue LoadError => e
trace("Install nap dependency")
View designer.html
<link href="../paper-toggle-button/paper-toggle-button.html" rel="import">
<polymer-element name="my-element">
<template>
<style>
#design_host {
position: absolute;
width: 100%;
height: 100%;