Skip to content

Instantly share code, notes, and snippets.

View baronTommy's full-sized avatar
:octocat:
ぎっとはぶ

Tommy baronTommy

:octocat:
ぎっとはぶ
View GitHub Profile
@branneman
branneman / better-nodejs-require-paths.md
Last active June 29, 2024 16:00
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@tejacques
tejacques / HOCBaseRender.tsx
Last active May 2, 2022 13:05
React Higher Order Components in TypeScript
import * as React from 'react';
import { Component } from 'react';
export default function HOCBaseRender<Props, State, ComponentState>(
Comp: new() => Component<Props & State, ComponentState>) {
return class HOCBase extends Component<Props, State> {
render() {
return <Comp {...this.props} {...this.state}/>;
}
}
@zkat
zkat / index.js
Last active March 10, 2024 14:32
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@kazuma1989
kazuma1989 / components.ejs
Last active March 1, 2021 13:27
ロゼッタストーン EJS, Handlebars, Jade(現在は Pug)の比較
<% if(components.length) { %>
<nav>
<h2 class="aigis-module__heading">Components</h2>
<ul class="aigis-moduleList"><% components.forEach(function(component) { %>
<li class="aigis-moduleList__item">
<a href="#<%- component.config.name %>"><%- component.config.name %></a>
</li><% }) %>
</ul>
</nav>
<div><% components.forEach(function(component) { %>
@kenmori
kenmori / styled-components-howtouse.md
Last active May 2, 2024 03:48
styled-componentsの使い方(パッとわかりやすく、色々なパターンを説明することを目指しています)

styled-componentsの使い方(パッとわかりやすく、色々なパターンを説明することを目指す記事)

styled-compoents

本家ドキュメント

こちらはStyled-componentsの使い方、ユースケースを集めた端的なページです。
なにかの問題解決、参考になりましたらスターを押してくださいませ。励みになります。
@anekos
anekos / x-yaml-to-json.vim
Created November 2, 2018 14:26
自動で YAML に変換して書きだす Vim さん (*.x.yaml とすること)
" 自動で YAML に変換して書きだす (*.x.yaml とすること) {{{
function! s:yaml_to_json()
let l:from = expand('%')
let l:to = expand('%:r:r') . '.json'
let l:result = system('ruby -rjson -ryaml -e "puts(JSON.pretty_generate(YAML.load(ARGF.read)))" ' . shellescape(l:from) . ' > ' . shellescape(l:to))
if v:shell_error
echoerr printf("Failed to yaml_to_json: %d\n%s", v:shell_error, l:result)
endif
endfunction
@mizchi
mizchi / predict-frontend.md
Last active May 12, 2023 03:43
React のユーザーから見た今後のフロントエンドの予想

この記事は議論のたたき台で、ポジショントークや、偏見にまみれています。

今のフロントエンドの分類

  • 古典的なサーバーサイド WAF への +α の味付け
  • 大規模なクライアントアプリケーション管理のための SPA
  • SEO / SSR を考慮した Node ヘヴィーな環境

他、提唱されてるパターン

@AquiTCD
AquiTCD / .cz-config.js
Created November 30, 2018 01:55
.cz-config
'use strict';
module.exports = {
types: [
{
value: 'feat',
name: 'feat: 新機能',
title: 'Features'
},
{
value: 'fix',