Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env -S deno run --allow-run --allow-read --allow-env
import { $ } from "jsr:@david/[email protected]";
import { Select } from "jsr:@cliffy/[email protected]/select";
// 定数
const SHA_DISPLAY_LENGTH = 7;
interface CommitInfo {
sha: string;
#!/usr/bin/env -S deno run --allow-run --allow-read --allow-env
import { $ } from "jsr:@david/[email protected]";
import { Select } from "jsr:@cliffy/[email protected]/select";
interface LogEntry {
hash: string;
subject: string;
refs: string;
branches: string[];
@haradakunihiko
haradakunihiko / gist:db76df19a78d736e008150dcb4ddc291
Created January 23, 2025 13:01
PHP AST analysis for function call
<?php
namespace Tests\StaticAnalysis\Visitor;
use PhpParser\Node;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Identifier;
use PhpParser\NodeDumper;
use PhpParser\NodeVisitorAbstract;
@haradakunihiko
haradakunihiko / git-log-range-for-copied-files-recursive.sh
Last active April 10, 2023 03:00
git log -L for copied file (track multiple times copy)
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Please provide the -L argument in the format '-L20,21:filepath'."
exit 1
fi
# Parse the -L argument
IFS=':' read -ra parts <<< "$1"
@haradakunihiko
haradakunihiko / git-log-range-for-copied-file.sh
Last active April 10, 2023 02:58
git log -L for copied file (only follow one copy) .
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Please provide the -L argument in the format '-L20,21:filepath'."
exit 1
fi
# Parse the -L argument
IFS=':' read -ra parts <<< "$1"
@haradakunihiko
haradakunihiko / modifyPushState.js
Last active July 11, 2016 07:24
jscodeshift transform module to change pushState syntax from 1x to 2x, where using pushState or replaceState function directly. (original: https://github.com/reactjs/rackt-codemod)
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _historyLibParsePath = require('history/lib/parsePath');
var _historyLibParsePath2 = _interopRequireDefault(_historyLibParsePath);
@haradakunihiko
haradakunihiko / connectMultipleRecords.js
Last active November 12, 2015 12:08
work around to get multiple form data for redux-form
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { createSelectorCreator } from 'reselect';
import { reduxForm } from 'redux-form';
const connector = connect(state => ({
reduxOriginalForm: state.form
}));
export function collectFormState(state, form, fields, keys ) {
import { connect } from 'react-redux';
import { createSelectorCreator } from 'reselect';
import { reduxForm } from 'redux-form';
function memoize(func, equalityCheck = (a, b) => a === b) {
const lastArgsCache = {};
const lastResultCache = {};
return (...args) => {
const memoizeKey = args.pop();
const lastArgs = lastArgsCache[memoizeKey];
@haradakunihiko
haradakunihiko / react-basic-gulpfile.js
Last active August 29, 2015 14:24
basic gulpfile and package file for react.js
var gulp = require('gulp');
var browserify = require('browserify');
var reactify = require('reactify');
var watchify = require('watchify');
var source = require('vinyl-source-stream');
var duration = require('gulp-duration');
var gulpUtil = require('gulp-util');
var sass = require('gulp-sass');
var buildScript = function(watch){
@haradakunihiko
haradakunihiko / start-server-package.json
Last active August 29, 2015 14:24
Most simple package.json for local server by node.js
{
"name": "todos",
"version": "1.0.0",
"scripts": {
"start": "http-server"
},
"dependencies": {
"http-server": "^0.7.4"
}
}