Skip to content

Instantly share code, notes, and snippets.

@talibasya
talibasya / wt-new
Last active February 4, 2026 13:23
Worktree bash
#!/usr/bin/env zsh
set -euo pipefail
# Usage: wt-new <branch-name> [--path /path/to/project]
# Example: wt-new "Feature/ABC 123" --path /Users/me/repo
branch_name=""
root_path=""
ignore_root_check=false
const isSupported = () => {
return 'Notification' in window
}
const requestPermission = async () => new Promise(resolve => Notification.requestPermission(resolve))
module.exports = {
isSupported,
requestPermission
}
const actions = require('./actions')
const socketEvents = new Map()
const socketRequests = new Map()
// the handlers will invoke with the parameter socketId and perform fetched session by socketId
socketEvents.set('PONG', actions.socket.pong)
socketEvents.set('ACTION_1', actions.socket.actionHandler1)
@talibasya
talibasya / endpoint.js
Created May 15, 2019 10:27
spreadsheet action
var testEvent = {
parameter: {
Name: 'test name',
Email: 'test@gmail.com'
}
}
var authCode = ""
var decSheetId = 0
var liteExpertSheetId = 0
@talibasya
talibasya / debug.js
Created February 18, 2019 09:56
get buffer hex line from string
// =============TEST MODE=============
const bodyStr = `{
"created": 1326853478,
"livemode": false,
"id": "account.application.authorized_00000000000000",
"type": "account.application.authorized",
"object": "event",
"request": null,
"pending_webhooks": 1,
"api_version": "2019-02-11",
@talibasya
talibasya / events.js
Created August 5, 2018 10:18
Reactive action creator
export const createReactiveEvent = (eventTriggers = {}) => {
let previousState
return (eventHandlers = {}) => {
return state => {
Object.keys(eventTriggers)
.filter(kTrigger => eventTriggers[kTrigger](state, previousState))
.map(kTrigger => eventHandlers[kTrigger](state, previousState))
previousState = state
@talibasya
talibasya / advanced_git.md
Last active September 1, 2018 14:10
Advanced github

Git

Create commit manually

Launch two shell sessions:

  • first with script while; do; clear; tree .git; sleep 1; done; (review screen)
  • second: git init

Remove hooks directory: rm -rf .git/hooks

@talibasya
talibasya / AppNotification.js
Last active June 6, 2017 06:24
Example how to perform redux notification (`react-notification-system`)/spinner (`material-ui`) based on `redux-store-ancillary`
import React from 'react'
// import NotificationSystem from 'react-notification-system'
import { connect } from 'react-redux'
import { hideNotification, NotificationProvider } from 'redux-store-ancillary/notification'
const mapStateToProps = (state) => ({
notification: state.notification
})
const mapDispatchToProps = {
@talibasya
talibasya / dashboard.js
Created March 20, 2017 14:47
dashboard structure
// _______________________________
// src/routes/Dashboard/containers/DashboardContainer.js
// _______________________________
import { connect } from 'react-redux'
import {
dashboardVisitIncrement,
dashboardAddItem,
dashboardEditItem,
dashboardReorderItems
} from '../modules/dashboard'