Skip to content

Instantly share code, notes, and snippets.

const sharp = require('sharp');
const countColors = (sharpBuffer) => {
let colorCounts = {};
for (let i = 0; i < sharpBuffer.length; i += 3) {
const r = sharpBuffer[i];
const g = sharpBuffer[i + 1];
const b = sharpBuffer[i + 2];
const rgb = `rgb(${r},${g},${b})`;
@a13e
a13e / zshrc_useful.sh
Created July 8, 2019 02:30 — forked from mollifier/zshrc_useful.sh
少し凝った zshrc
# 少し凝った zshrc
# License : MIT
# http://mollifier.mit-license.org/
########################################
# 環境変数
export LANG=ja_JP.UTF-8
# 色を使用出来るようにする
@a13e
a13e / CustomTableViewCell.swift
Created March 17, 2018 04:54
Custom TableViewCell Class without nib
import UIKit
class CustomTableViewCell : UITableViewCell {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
}
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: UITableViewCellStyle.default, reuseIdentifier: "CustomTableViewCell")
self.setup()
def execute
a = [1, 2, 3]
a.each do |i|
begin
puts i
raise "error!"
rescue => e
puts e
raise "aiueo"
require 'csv'
lines_for_output = []
CSV.foreach("momoda.csv") do |row|
row_text = row[0] + row[1]
line = {}
line[:rank] = row_text.scan(/.*位/).first
@a13e
a13e / conexio_parser.rb
Created December 13, 2016 12:15
コネクシオ店舗名取得HTML Parser
require 'rubygems'
require 'nokogiri'
require 'open-uri'
PAGE_URL = "https://www.conexio.co.jp/business/consumer/shop/network/index.html"
page = Nokogiri::HTML(open(PAGE_URL))
page.css(".grid2").each do |elem|
puts elem.text
@a13e
a13e / curvy.txt
Created September 26, 2016 10:27
── ── ── ── ── ── ██ ██ ██ ██ ██ ── ██ ██ ── ──
── ── ── ── ██ ██ ▒▒ ░░ ░░ ░░ ░░ ██ ▒▒ ░░ ██ ──
── ── ── ██ ▒▒ ░░ ░░ ██ ░░ ██ ░░ ░░ ██ ░░ ░░ ██
── ── ██ ▒▒ ░░ ░░ ░░ ██ ░░ ██ ░░ ░░ ░░ ▒▒ ░░ ██
── ── ██ ░░ ░░ ░░ ░░ ██ ░░ ██ ░░ ░░ ░░ ▒▒ ▒▒ ██
── ██ ░░ ░░ ░░ ▒▒ ▒▒ ░░ ░░ ░░ ▒▒ ▒▒ ░░ ░░ ▒▒ ██
██ ▒▒ ░░ ░░ ░░ ░░ ░░ ░░ ██ ░░ ░░ ░░ ░░ ░░ ░░ ██
██ ░░ ░░ ▒▒ ░░ ░░ ░░ ░░ ██ ░░ ░░ ░░ ░░ ░░ ▒▒ ██
██ ░░ ░░ ▒▒ ░░ ░░ ░░ ░░ ░░ ░░ ░░ ░░ ░░ ░░ ██ ──
── ██ ██ ██ ░░ ░░ ░░ ░░ ░░ ░░ ░░ ░░ ░░ ▒▒ ██ ──
module Dojo
class Zone
end
class << self
def osu!
puts "osu!"
end
end
@a13e
a13e / kaijo.php
Last active May 12, 2016 06:11
PHPで階乗
<?php
function kaijo($i){
if ($i == 1) {
return 1;
}else{
$n = $i * kaijo($i-1);
return $n;
}
}
@a13e
a13e / 0_reuse_code.js
Created February 29, 2016 14:01
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console