Skip to content

Instantly share code, notes, and snippets.

@SamuraiT
SamuraiT / marketplace.sol
Created March 6, 2022 14:19 — forked from dabit3/marketplace.sol
NFT Marketplace Smart Contract (V2)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "hardhat/console.sol";
contract NFTMarketplace is ERC721URIStorage {

はじめに

CoderDojo Advent Calendar 2021のの22日目を担当しています。 学生の時にCoder Dojoで少しプログラミングを小学生や中学生に教えていたことがあります。それがCoder Dojoとの出合いになります。

今回は、Coder Dojoとは直接は関係ないですが、 jagram(JApanese proGRAMming Language, ジャグラム)といRubyのプログラミングを日本語で書けるプログラミング言語ツールを開発したので、開発した背景とツールの使い方を紹介したいと思います。(Jagram、ジャグラムと読みます。JApanese proGRAMming Languageの略称です。厳密には言語ではなくRubyのツールです)

jagramはまだ作ったばかりなので、変更点たくさんあるかと思いますので、PRお待ちしております。githubへのスターもお待ちしてますw

また、実際に使われてなんぼなので、教育の現場で使っていただけると大変喜ばしいです。

@SamuraiT
SamuraiT / gist:3a0f952f14fd3b5ae4f7
Created January 1, 2016 11:35 — forked from jmblog/gist:6077993
所得税と住民税の計算方法

所得税(国税)

所得税の計算方法

所得税額 = (所得金額(A) - 所得控除額(B)) × 税率 - 税額控除額(C)

  • 「所得金額(A)- 所得控除額(B)」は 課税所得金額 といい、1,000円未満の端数を切り捨てる。

所得税の税率

@SamuraiT
SamuraiT / tmux.sh
Last active September 30, 2015 09:20
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
git clone https://github.com/seebi/tmux-colors-solarized.git ~/.tmux/plugins/tmux-colors-solarized
cat ~/.tmux/plugins/tmux-colors-solarized/tmuxcolors-256.conf >> ~/.tmux.conf
echo "set -g @plugin 'seebi/tmux-colors-solarized'" >> ~/.tmux.conf
echo "set-option -g prefix C-o" >> ~/.tmux.conf
tmux source ~/.tmux.conf
@SamuraiT
SamuraiT / show_routes.sh
Last active August 29, 2015 14:23
show-routes
show_routes() {
#TODO ADD Usage
# remove {:id=>/\d+/}
if [ -z "$1" ]; then
bundle exec rake routes | sed -n 's/ */ | /gp'
else
bundle exec rake routes | grep $1 | sed -n 's/ */ | /gp'
fi
}
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@SamuraiT
SamuraiT / proxy.rb
Last active August 29, 2015 14:21 — forked from torsten/proxy.rb
#!/usr/bin/env ruby
# A quick and dirty implementation of an HTTP proxy server in Ruby
# because I did not want to install anything.
#
# Copyright (C) 2009-2014 Torsten Becker <torsten.becker@gmail.com>
#
# 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 to use, copy, modify, merge, publish,
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')