Skip to content

Instantly share code, notes, and snippets.

View toshimaru's full-sized avatar

Toshimaru toshimaru

View GitHub Profile
@toshimaru
toshimaru / webpacker.md
Created December 9, 2016 20:47
Try webpacker

Try webpacker

Try rails/webpacker

Installation

gem 'webpacker', github: "rails/webpacker"
<html>
<head>
<title>data-attribute test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<div id="tgt" data-msg='my message is here!'>
<p>Foo</p>
<p>Bar</p>
</div>

Untitled Slide

Welcome to Glide.

Glide is the easiest way to create useful slide for all of your Gists.

  • input key <- to go backward.
  • input key -> to go forward.

Publishing

##人への関心:誰と、どのくらいの時間会っているかを把握しているか?

  • 情報はいうまでもなく、金もまた人についてくることを知っている。

  • 大切な人に会うための時間は、ほかの予定を変えてでも捻出する。

  • 待ち合わせの場所には、常に約束の時間より余裕をもって到着する。

  • 勉強会や交流会への参加は、会の内容より、参加者の顔ぶれで決める。

desc 'Check links for site already running on localhost:4000'
task :check_links do
begin
require 'anemone'
root = 'http://localhost:4000/'
Anemone.crawl(root, :discard_page_bodies => true) do |anemone|
anemone.after_crawl do |pagestore|
broken_links = Hash.new { |h, k| h[k] = [] }
pagestore.each_value do |page|
if page.code != 200
@toshimaru
toshimaru / dgsync.bat
Created April 18, 2013 18:37
[Windows] sync amazon S3 with DragonDisk Command line sync tool. http://www.dragondisk.com/download-amazon-s3-client-google-cloud-storage-client.html
SET DGTOOLS_ACCESS_KEY=XXXXXXXXXXXXX
SET DGTOOLS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXX
dgsync -v --ssl --dont-delete --endpoint "s3-ap-northeast-1.amazonaws.com" "C:\Users\toshi\picture" "s3://your-s3-bucket/picture"

Usage

 $('#id').trace()

.find('.class').trace();

#/bin/sh
for file in `ls | egrep '[0-9A-z、-◯ぁ-んァ-ヶ亜-腕弌-熙]'`; do
rename_file=`echo ${file} | sed -e 's/[0-9A-z、-◯ぁ-んァ-ヶ亜-腕弌-熙]//g'`
mv $file $rename_file
done
@toshimaru
toshimaru / ForceProperty.php
Last active December 12, 2015 05:28
Normaly, PHP Object can have property freely. But I want to force Object to have the property. This implementation make it possible.
<?php
class ForceProperty {
private $val;
public function __get($name) {
if (property_exists($this, $name)) {
return $this->$name;
} else {
throw new LogicException(sprintf('Undefined property: $%s', $name));
<?php
// add exception_handle
function exception_handler($exception) {
echo "Uncaught exception: file:{$exception->getFile()} line:{$exception->getLine()} {$exception->getMessage()}", "\n";
}
set_exception_handler('exception_handler');