Skip to content

Instantly share code, notes, and snippets.

問題1. 選択肢の中からRubyの予約語ではないものを2つ選択してください。

  • A.super
  • B.begin
  • C.try
  • D.goto

問題2. 以下のコードを実行した出力として正しいものを1つ選択してください。

def foo (a, *b)
 p a
@kawasaki2013
kawasaki2013 / gist:465b8e106e20d6eda052d9930ff01748
Created April 14, 2018 05:03 — forked from tell-k/gist:c7552ef551f06620e2f029f1495fe173
ブロック内のコードをスキップできる + スコープを共有しない with statetment
# 1. ブロック内のコードを実行しない with -------
# refs http://stackoverflow.com/questions/12594148/skipping-execution-of-with-block
import sys
import inspect
class SkipContext:
def __enter__(self):
# 1. SkipContextの外側のframeを取得
self.frame, _, _, _, _, _ = inspect.getouterframes(inspect.currentframe())[1]
@kawasaki2013
kawasaki2013 / cli_template.go
Created September 26, 2017 07:59 — forked from MakoTano/cli_template.go
github.com/codegangsta/cli を使ったコマンドラインツールのテンプレート
package main
import (
"fmt"
"os"
"github.com/codegangsta/cli"
)
func main() {
@kawasaki2013
kawasaki2013 / cli_template.go
Created September 26, 2017 07:59 — forked from MakoTano/cli_template.go
github.com/codegangsta/cli を使ったコマンドラインツールのテンプレート
package main
import (
"fmt"
"os"
"github.com/codegangsta/cli"
)
func main() {
@kawasaki2013
kawasaki2013 / eightbit.go
Created August 2, 2017 13:14 — forked from telecoda/eightbit.go
8 bit pixel example with Ebiten
package main
import (
"fmt"
"image"
"image/color"
"image/draw"
"log"
"github.com/fogleman/gg"
@kawasaki2013
kawasaki2013 / wordcounter.c
Created August 2, 2017 13:12
Count words in source file. Print them in lexicographical order or by occurrence frequency.
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <memory.h>
#include <stdbool.h>
#define MSG_PROG_INFO "Count words in source"
#define MSG_PATH_PROMPT "Path to the source file:"
#define MSG_OUTPUT_OPTIONS "\nInput:\n1 - output lexicographically\n2 - output by frequency\n"
#define MSG_INPUT_ERROR "Error: incorrect input"
#!/bin/bash
CURRENT_DIR="$( dirname "${BASH_SOURCE[0]}" )"
export PATH=${PATH/$CURRENT_DIR}
args=()
for arg in "$@"; do
if [[ "$arg" =~ ^@.* ]]; then
file="${arg#@}"
if [ -f "$file" ]; then
for a in $(cat "$file"); do
args+=("$a")
@kawasaki2013
kawasaki2013 / gist-test.html
Created August 2, 2017 11:26 — forked from BrendanFDuffy/index.html
gist-test.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
width: 960px;
height: 500px;
position: relative;
}
form {
@kawasaki2013
kawasaki2013 / grep.text
Created August 2, 2017 11:25 — forked from zard777/grep.text
Command to grep spoofed package names from hacktask npm user
find . -name "package.json" -exec grep -nwE 'babelcli|crossenv|cross-env.js|d3.js|fabric-js|ffmepg|gruntcli|http-proxy.js|jquery.js|mariadb|mongose|mssql.js|nodecaffe|nodefabric|node-fabric|nodeffmpeg|nodemailer-js|nodemailer.js|nodemssql|node-opencv|node-opensl|node-openssl|noderequest|nodesass|nodesqlite|node-sqlite|node-tkinter|opencv.js|openssl.js|proxy.js|shadowsock|smb|sqlite.js|sqliter|sqlserver|tkinter' {} +
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>WebSocket test</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style>