Skip to content

Instantly share code, notes, and snippets.

Avatar
🎧

Danilo Woznica danilowoz

🎧
View GitHub Profile
@danilowoz
danilowoz / createNode.js
Created Feb 24, 2017
Convert String to Dom element
View createNode.js
function createNode( html ) {
return new DOMParser().parseFromString( html, "text/html" ).body.firstChild
}
var foo = createNode("<p>Texto<span>Olá</span></p>");
View Roter.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Building a router</title>
<script>
var Router = {
routes: [],
mode: null,
root: '/',
View JavaScript (Babel).sublime-syntax
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: JavaScript (Babel)
file_extensions: [js, jsx, babel, es6]
first_line_match: ^#!\s*/.*\b(node|js)$\n?
scope: source.js
variables:
ident: '[_$a-zA-Z][$\w]*'
View Import stories
import { configure } from '@storybook/react'
import './style.css'
const req = require.context('../src/', true, /stories\.js$/)
function loadStories() {
req.keys().forEach(req)
}
configure(loadStories, module)
@danilowoz
danilowoz / Delete merged branches from local.txt
Created Dec 18, 2017
Delete merged branches from local
View Delete merged branches from local.txt
git branch --merged | grep -v -e "master" -e "\*" | xargs -n 1 git branch -d
View touchable.css
@media (pointer: coarse) and (hover: none) { }
/* https://css-tricks.com/touch-devices-not-judged-size/ */
View git alias
# .gitconfig
[user]
email = danilowoz@gmail.com
[alias]
st = status
ci = commit
br = branch
co = checkout
up = "!git remote update -p; git merge --ff-only @{u}"
emenda = commit --amend --no-edit
View emojis.md

👍 👎 💯 🔢 🥇 🥈 🥉 🎱 🅰️ 🆎

View scroll-decorator.jsx
import React, { Component } from "react"
import VisibilitySensor from "react-visibility-sensor"
const optsVisibily = {
minTopValue: 400,
partialVisibility: true,
scrollDelay: 100
}
const WithScroll = WrapComponent =>
@danilowoz
danilowoz / React.context.class.App.js
Last active Jan 14, 2020
Gist: React.Context<Class | Hooks>
View React.context.class.App.js
import React from "react";
import Provider, { Consumer } from "./Context";
const App = () => (
<Provider>
<Consumer>
{({ count }) => {
return (
<div>