Skip to content

Instantly share code, notes, and snippets.

View tai-sho's full-sized avatar
🏠
Working from home

ShoheiTai tai-sho

🏠
Working from home
View GitHub Profile
<?php
/*
MIT License
Copyright (c) 2021 HAYASHI-Masayuki
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@notchi590
notchi590 / slack-emoji-exporter.js
Last active August 9, 2022 09:39
slack emoji exporter written in Node.js
var request = require('request');
var fs = require('fs');
var url = "https://slack.com/api/emoji.list?pretty=1";
var token = "Bearer <token here>";
request.get({
url : url,
headers : {
"Authorization" : token
}
@mizchi
mizchi / predict-frontend.md
Last active May 12, 2023 03:43
React のユーザーから見た今後のフロントエンドの予想

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

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

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

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

<!-- bold-cart-item.liquid -->
{% comment %} Last updated 2018-May-14 {% endcomment %}
{% capture bold_cart_item_liquid %}
{% comment %}
BOLD-CART-ITEM.LIQUID - Universal Bold Cart Updater
This file creates liquid variables to assist in updating line items in cart.liquid.
USED BY: Product Options, Recurring Orders, Product Builder
REQUIRES: bold.css
@keirwhitaker
keirwhitaker / srcset.liquid
Created July 12, 2017 14:42
An example of how to use srcset in Shopify themes
{% for product in collection.products %}
<a href="{{ product.url | within: collection }}">
{% assign image = product.featured_image %}
<img src="{{ image.src | img_url: '480x' }}" alt="{{ image.alt | escape }}"
srcset="
{% if image.width > 640 %}{{ image.src | img_url: '640x' }} 640w{% endif %}
{% if image.width > 720 %},{{ image.src | img_url: '720x' }} 720w{% endif %}
{% if image.width > 900 %},{{ image.src | img_url: '900x' }} 900w{% endif %}
"
sizes="(min-width: 960px) 450px, (min-width: 720px) 50vw, 100vw"
@uramonk
uramonk / mnist_for_ml_beginners.py
Created May 12, 2016 02:31
TensorFlow MNIST For ML Beginners チュートリアルのコード
# -*- coding: utf-8 -*-
# TensowFlowのインポート
import tensorflow as tf
# MNISTを読み込むためinput_data.pyを同じディレクトリに置きインポートする
# input_data.pyはチュートリアル内にリンクがあるのでそこから取得する
# https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/examples/tutorials/mnist/input_data.py
import input_data
import time
@gregrickaby
gregrickaby / social-sharing-with-javascript-popup.php
Last active October 21, 2019 02:33
Social Sharing with Javascript Pop-up
<?php
/**
* Social sharing links.
*/
function wds_client_get_social_share_links( ) {
$facebook_url = 'https://www.facebook.com/sharer/sharer.php?u=' . rawurlencode ( get_the_permalink() );
$twitter_url = 'https://twitter.com/intent/tweet?text=?text=' . urlencode( html_entity_decode( get_the_title() ) ) . '&amp;url=' . rawurlencode ( get_the_permalink() );
$linkedin_url = 'https://www.linkedin.com/shareArticle?mini=true&amp;url=' . rawurlencode ( get_the_permalink() ) . '&amp;title=' . urlencode( html_entity_decode( get_the_title() ) );
@slayerfat
slayerfat / phpmd-ruleset.xml
Last active April 9, 2024 03:09
php mess detector ruleset for laravel and similar frameworks
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Laravel and similar phpmd ruleset"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Inspired by https://github.com/phpmd/phpmd/issues/137
using http://phpmd.org/documentation/creating-a-ruleset.html
</description>
@mgng
mgng / resize_exif_delete.php
Created August 17, 2015 05:54
画像リサイズおよびexifの削除処理
<?php
$blob = getResizedImageBlob("./sample.png", 100, 200);
file_put_contents("sample_100x200.png", $blob);
/**
* @param string $img_path 画像ファイルパス
* @param string int $w_re リサイズ後の幅
* @param string int $h_re リサイズ後の高さ
* @return string
@davidblewett
davidblewett / lp-ssh-add.sh
Last active December 12, 2021 11:12
Allow storage of SSH private keys in LastPass, and use lpass CLI to retrieve and load into ssh-agent. The general idea is to store the private key armored ASCII in an "SSH Key" Secure Note, in a specific folder (i.e.: "Secure Notes\SSH" ).
#!/bin/sh
#
# Import all SSH keys from LP
#
PREFIX=~
SSH_ASKPASS=$PREFIX/bin/lp-askpass.sh
export SSH_ASKPASS
# This is needed to force ssh-add to honor our SSH_ASKPASS.
DISPLAY=foo
export DISPLAY