Skip to content

Instantly share code, notes, and snippets.

View zufrizalyordan's full-sized avatar
🧑‍🚀
I may be slow to respond.

Zufrizal Yordan zufrizalyordan

🧑‍🚀
I may be slow to respond.
  • Bandung, Indonesia
  • 17:59 (UTC +07:00)
View GitHub Profile
@ebidel
ebidel / coverage.js
Last active October 18, 2025 09:48
CSS/JS code coverage during lifecycle of page load
Moved to https://github.com/ebidel/puppeteer-examples
@ego008
ego008 / multiple-host-reverse-proxy.go
Last active August 24, 2025 12:18
Multiple host reverse proxy in Go
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
)
var (
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Picker,
Item,
Button,
AsyncStorage,
@bmorelli25
bmorelli25 / app.js
Created May 28, 2017 15:13
Twitter Favorite Bot
var Twitter = require('twitter');
var config = require('./config.js');
var T = new Twitter(config);
// Set up your search parameters
var params = {
q: '#nodejs',
count: 10,
result_type: 'recent',
lang: 'en'
@ilan-schemoul
ilan-schemoul / jsx
Created April 9, 2017 08:44
Search box with react@next
import React from 'react';
import Icon from '/node_modules/material-ui/Icon/Icon';
import Layout from '/node_modules/material-ui/Layout/Layout';
import Paper from '/node_modules/material-ui/Paper/Paper';
import Magnify from '/node_modules/mdi-react/MagnifyIcon.js';
import injectSheet from 'react-jss';
const styles = {
outsideContainer: {

tracked npm

@tracked is a decorator for Preact that makes working with state values no different than properties on your component instance.

It's one 300 byte function that creates a getter/setter alias into state/setState() for a given key, with an optional initial value. The "magic" here is simply that it works as a property decorator rather than a function, so it appears to integrate directly into the language.

tracked has no dependencies and works with any component implementation that uses this.state and this.setState().

Installation

let Components = require('./Components').default;
let Demo = () => (
<Router history={createHashHistory()}>
<Components path="/" />
{ require.context('./demos', true, /Demo$/).keys().map( file =>
<LazyComponent load={ cb => require.ensure(file, cb) } />
) }
</Router>
);
@markerikson
markerikson / dispatching-action-creators.js
Last active June 28, 2024 05:29
Dispatching action creators comparison
// approach 1: define action object in the component
this.props.dispatch({
type : "EDIT_ITEM_ATTRIBUTES",
payload : {
item : {itemID, itemType},
newAttributes : newValue,
}
});
// approach 2: use an action creator function
@sid24rane
sid24rane / websqlcrud.js
Created May 31, 2016 09:00
Web SQL Database Basic CRUD ( Create,Read,Update,Delete ) operation implementation!
function createDb() {
var db_name = 'jabber';
var db_version = '1.0';
var db_describe = 'Bro,its jabber';
var db_size = 2048;
var db = openDatabase(db_name, db_version, db_describe, db_size, function(db) {
console.log(db);
console.log("Database opened Successfully! Or created for the first time !");
createTable(db);
});
@kidGodzilla
kidGodzilla / invert-binary-tree.js
Created May 28, 2016 19:42
Invert a Binary Tree in Javascript
// This problem was inspired by this original tweet by Max Howell:
// Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off.
// So, let's invert a binary tree in Javascript
// Original Tree
// 4
// / \
// 2 7
// / \ / \