Skip to content

Instantly share code, notes, and snippets.

Daisuke Fujimura fujimura

Block or report user

Report or block fujimura

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fujimura
fujimura / nippou_matome.rb
Created Dec 27, 2018
一年分の日報から「本日の作業内容」を抜き出してまとめて出力
View nippou_matome.rb
i = 1
entries = []
name = 'fujimura'
until entries.length > 0 && entries.last['full_name'] =~ %r{2017/12}
r = HTTPClient.get(
'https://api.esa.io/v1/teams/proper-inc/posts',
access_token: ENV['ESA_TOKEN'],
q: "in:日報 user:#{name}",
page: i
@fujimura
fujimura / debt.md
Last active Mar 2, 2019
技術的負債とは何だったのか、技術的負債はなくならないのか
View debt.md
View interactive_migration.rb
require 'cli/ui'
unless ActiveRecord::SchemaMigration.table_exists?
abort "Schema migrations table does not exist yet."
end
def migrations
ActiveRecord::Base.connection.migration_context.migrations_status.map do |status, version, name|
"#{status.ljust(8)} #{version.ljust(14)} #{name}"
end
@fujimura
fujimura / markdown_to_html_slide_to_pdf.js
Created Mar 12, 2018
markdown_to_html_slide_to_pdf.js
View markdown_to_html_slide_to_pdf.js
const fs = require("fs");
const { execSync } = require("child_process");
const path = require("path");
const puppeteer = require("puppeteer");
const htmlToPdf = async src => {
const browser = await puppeteer.launch();
try {
const dest = `${path.basename(src)}.pdf`;
View archimedean.rb
require 'json'
def get_lonlat_in_spiral(i)
v = Complex.polar i, i/4.9 * Math::PI/2
angle = v.angle
magnitude = v.magnitude
[magnitude * Math.cos(angle), magnitude * Math.sin(angle)]
end
r = 10.upto(30).map { |i| get_lonlat_in_spiral(i) }
View st_astext_empty.sql
SELECT
ST_ASText(
ST_GeometryN(
ST_GeneratePoints(
ST_GeomFromText('MULTIPOLYGON (((102.7687 35.07, 104.4969 35.07, 104.4969 35.06, 102.7687 35.06, 102.7687 35.07)))', 4326),
1
),
1
)
)
@fujimura
fujimura / pre-commit
Created Dec 6, 2017
pre-commit hook to run prettier
View pre-commit
#!/bin/sh
# Taken from https://prettier.io/docs/en/precommit.html#option-3-bash-script and added (s)css as target
jsfiles=$(git diff --cached --name-only --diff-filter=ACM "*.js" "*.jsx" "*.css" "*.scss" | tr '\n' ' ')
[ -z "$jsfiles" ] && exit 0
# Prettify all staged .js files
echo "$jsfiles" | xargs yarn run prettier --write
# Add back the modified/prettified files to staging
echo "$jsfiles" | xargs git add
View c.js
// @flow
type A = {
x: number,
y: number,
type: "A"
};
type B = {
x: number,
View match.rb
module Match
def self.define_matchers!(m)
m.constants.each {|c|
eval "class #{c} < StandardError; end"
}
end
def self.match! obj
raise self.const_get(obj.class.to_s).new(obj)
end
View HiddenInputsForDatetimeSelect.jsx
// @flow
import React from 'react';
const splitTimeComponent = (t: Date): number[] => {
return [
t.getFullYear(),
t.getMonth(),
t.getDate(),
t.getHours(),
t.getMinutes()
You can’t perform that action at this time.