Skip to content

Instantly share code, notes, and snippets.

View nicolasparada's full-sized avatar
👨‍💻

Nicolás Parada nicolasparada

👨‍💻
View GitHub Profile
@nicolasparada
nicolasparada / 1.0
Created July 14, 2015 05:10
Activity Stream
{
"items": [
{
"actor": {
"objectType": "",
"id": ""
},
"verb": "",
"object": {
"id": ""
@nicolasparada
nicolasparada / gestures.md
Last active October 16, 2022 15:40
Switch desktop in Windows 10 with three fingers gesture. Working on HP Spectre x360 with Synaptics.

Gestures

Virtual key codes:

  • 3 keys: 0x33
  • Ctrl key: 0x11
  • Windows key: 0x5B
  • Left arrow key: 0x25
  • Right arrow key: 0x27
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Acme
{
public abstract class BindableBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SetProperty<T>(ref T property, T value, [CallerMemberName] string propertyName = null)
import Html exposing (..)
import Html.App as App
import Html.Attributes as Attr exposing (..)
import Html.Events as Event exposing (..)
main = App.beginnerProgram
{ model = model
, view = view
, update = update
}
const waterfall = (array = []) => {
const iterate = index => (...args) => {
const fn = array[index]
const next = iterate(index + 1)
return fn ?
Promise.resolve(fn(...args, next)) :
Promise.resolve(...args)
}
@nicolasparada
nicolasparada / hello-world.js
Last active November 21, 2016 11:42
Custom Element: Hello, world!
// import diff from 'diffhtml'
class HelloWorld extends HTMLElement {
constructor() {
super()
this.name = 'world'
this.render = this.render.bind(this)
this.onInput = this.onInput.bind(this)
@nicolasparada
nicolasparada / root.jsx
Created February 11, 2017 15:27
Preact router code splitting
import { Component, h } from 'preact'
import Router from 'preact-router'
import Nav from './components/nav.jsx'
const asyncComponent = getComponent => class extends Component {
componentWillMount() {
if (!this.state.component) {
getComponent()
.then(module => module.default)
.then(this.linkState('component'))
@nicolasparada
nicolasparada / script.js
Last active July 26, 2018 17:28
Redux Clone (Preact)
const { Component, h, render } = preact
const createStore = (reducer, initialState) => {
let listeners = []
let currentState = initialState
const getState = () => currentState
const subscribe = listener => {
listeners.push(listener)
@nicolasparada
nicolasparada / html.json
Last active April 3, 2017 10:17
VSCode Snippets
{
"Document": {
"prefix": "!",
"body": [
"<!DOCTYPE html>",
"<meta charset=\"utf-8\">",
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">",
"",
"<title>${1:Document}</title>",
"",
@nicolasparada
nicolasparada / ago.js
Last active June 3, 2018 00:15
Formats dates: Just now | 20s | 5m | 10h | 5d | 11 May | 18 Sep, 2017
const MONTHS = [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',