Skip to content

Instantly share code, notes, and snippets.

👻
my dear son

Toshimaru toshimaru

👻
my dear son
Block or report user

Report or block toshimaru

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
View nested_list.md
  • level-1
    • level-3
    • level-2
    • level-2
      • level-3

* level-3
  • level-2
View heredoc1.rb
def a
doc = <<-EOS
def hello
puts "Hello World!"
end
EOS
end
View arrow_def.rb
require 'benchmark/ips'
Benchmark.ips do |x|
ary = []
x.report(:a) {
10_000.times do |num|
ary << "#{num} #{num * 2} #{num * 3}"
end
}
View webpacker.md

Try webpacker

Try rails/webpacker

Installation

gem 'webpacker', github: "rails/webpacker"
@toshimaru
toshimaru / terraform-ssh-remote-exec.tf
Last active Mar 16, 2019
How to connect to server via SSH and use remote-exec provisioner.
View terraform-ssh-remote-exec.tf
resource "digitalocean_droplet" "web" {
image = "ubuntu-16-04-x64"
name = "web-1"
region = "sgp1"
size = "512mb"
ssh_keys = [12345]
connection {
type = "ssh"
user = "root"
@toshimaru
toshimaru / install-mysql5.7-circleci.sh
Last active May 3, 2018 — forked from kimh/install-mysql5.7-circleci.sh
Install MySQL 5.7 non-interactively in CircleCI
View install-mysql5.7-circleci.sh
#!/bin/bash
set -x
set -e
export DEBIAN_FRONTEND=noninteractive
curl -LO https://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
echo mysql-apt-config mysql-apt-config/select-product select Apply | sudo debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-server select mysql-5.7 | sudo debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-connector-python select none | sudo debconf-set-selections
View read-data-attribute.html
<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>
View slide.md

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

@toshimaru
toshimaru / jquery-scroll-bottom.js
Last active Jul 12, 2019
Detect the scrolling to bottom of the page using jQuery.
View jquery-scroll-bottom.js
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
@toshimaru
toshimaru / scroll-to-element.js
Created Jul 12, 2013
Scroll to the particular element using jQuery.
View scroll-to-element.js
$('.info').on('click', function(){
$('html, body').animate({
scrollTop: $(this).offset().top
}, 500);
});
You can’t perform that action at this time.