Skip to content

Instantly share code, notes, and snippets.

View jackyu's full-sized avatar

Jack Yu jackyu

  • anue
  • Taiwan, Taipei
View GitHub Profile
@putuyoga
putuyoga / CustomStorage.js
Created July 25, 2018 03:28
React Native Custom Storage for Android
import RNFetchBlob from 'react-native-fetch-blob';
const DocumentDir = RNFetchBlob.fs.dirs.DocumentDir;
const storagePath = `${DocumentDir}/persistStore`;
const encoding = 'utf8';
const toFileName = name => (
name.split(':').join('-')
);
@bigsergey
bigsergey / review-checklist.md
Last active May 23, 2024 13:50
Front-end Code Review Checklist

Review checklist

General

  1. Does the code work?
  2. Description of the project status is included.
  3. Code is easily understand.
  4. Code is written following the coding standarts/guidelines (React in our case).
  5. Code is in sync with existing code patterns/technologies.
  6. DRY. Is the same code duplicated more than twice?
#!/usr/bin/env node
var esprima = require('esprima');
var estraverse = require('estraverse');
var escodegen = require('escodegen');
var fs = require('fs');
var _ = require('lodash');
var file = fs.readFileSync('./actions.js', 'utf-8');
var tree = esprima.parse(file);
@staltz
staltz / introrx.md
Last active June 18, 2024 06:15
The introduction to Reactive Programming you've been missing
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active April 2, 2024 02:45
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@kevinblake
kevinblake / google-analytics-data-events.js
Last active May 29, 2021 08:24
Fire Google Analytics Events using data attributes for label, action and category fields
var googleDataEvents = {
pageTracker: null,
init: function (document) {
document.find("a[data-ga-label],area[data-ga-label]").click(this.trackLink);
},
trackLink: function (e) {
if (_gaq) {
e.preventDefault();
var l = $(this);
var label = l.attr("data-ga-label");