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": ""
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 / 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>",
"",
Verifying my Blockstack ID is secured with the address 1CcXMTDRMcfAYnv2zMxn1dueK2mwrJJgoH https://explorer.blockstack.org/address/1CcXMTDRMcfAYnv2zMxn1dueK2mwrJJgoH
@nicolasparada
nicolasparada / styles.css
Last active May 24, 2018 09:47
Base Stylesheet
:root {
box-sizing: border-box;
font-family: sans-serif;
-ms-overflow-style: -ms-autohiding-scrollbar;
}
*,
::before,
::after {
box-sizing: inherit;
@nicolasparada
nicolasparada / main.go
Created June 1, 2018 00:32
To serve single page applications
package main
import (
"log"
"net/http"
)
func main() {
h := http.FileServer(spaFileSystem{http.Dir("static")})