Skip to content

Instantly share code, notes, and snippets.

View jun784's full-sized avatar
😄

Jun Kawasaki jun784

😄
View GitHub Profile
@branneman
branneman / better-nodejs-require-paths.md
Last active June 24, 2025 22:40
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

@keiono
keiono / d3js_day21.md
Last active January 1, 2016 00:29
D3.js Advent Calendar 2013 Day 21: D3.jsと周辺ツールを使ったデータの可視化

アプリケーションとしてまとめる

D3.js Advent Calendar 2013の21日目の記事です。今回はD3.jsのフォーマットや詳細技術というより、もう少し俯瞰的な視点で書いてみます。D3.jsを使う理由は、もちろん何らかのデータを可視化したいと言うことでしょうが、最終的にどのようなアプリケーションとしてまとめるかと言うゴールにはかなり幅があると思います。しかしそれでもいくつかの共通する課題が存在します。

テーブル形式のデータや、先のツールで書きだしたJSONなど、データを整えてD3.jsで使える形式として用意する事自体はそう難しいことではありません。手作業でスプレッドシートを使って作成してもいいし、スクリプト、もしくはOpenRefineなどといったツールで作成する方法もあります。そして一度D3.js内で扱える形式のデータが得られれば、それを様々な方法で可視化出来ます。そこから最終的な可視化を作成するプロセスで考えるべき事は次の二点でしょう:

  1. 最終的なアプリケーションとしてどうまとめるか
  2. そのアプリケーションを構築するモジュールの実装

この記事では、この2つについてまとめます。

<?php
$f = file_get_contents("url_obj.txt");
$a = array();
file_put_contents("urls.txt", "");
preg_match_all('/"http:.+?"/', $f, $a);
foreach($a[0] as $value) {
$value = str_replace("\\", "", $value);
$value = str_replace('"', "", $value);
file_put_contents("urls.txt", "{$value}\n", FILE_APPEND);
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@sile
sile / 0_raft.md
Last active May 27, 2024 07:53
Raft(分散合意アルゴリズム)について
@voluntas
voluntas / mqtt.rst
Last active February 15, 2025 04:35
MQTT とはなんだったのか

MQTT とはなんだったのか

更新:2017-05-09
作者:@voluntas
バージョン:3.14
URL:http://voluntas.github.io/

MQTT をググって調べた人向け

@learner-long-life
learner-long-life / Rinkeby.md
Last active August 30, 2022 22:32
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,