Skip to content

Instantly share code, notes, and snippets.

@mscottford
Created February 24, 2017 21:11
Show Gist options
  • Save mscottford/6b486d790b569582e8b2532f8e18541b to your computer and use it in GitHub Desktop.
Save mscottford/6b486d790b569582e8b2532f8e18541b to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"source": [
"puts 'test'"
],
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"test\n"
]
}
],
"execution_count": 3,
"metadata": {
"collapsed": false,
"outputHidden": false,
"inputHidden": false
}
},
{
"cell_type": "code",
"source": [
"'test'"
],
"outputs": [
{
"output_type": "execute_result",
"execution_count": 4,
"data": {
"text/plain": [
"\"test\""
]
},
"metadata": {}
}
],
"execution_count": 4,
"metadata": {
"collapsed": false,
"outputHidden": false,
"inputHidden": false
}
},
{
"cell_type": "code",
"source": [
"'test'.methods.sort"
],
"outputs": [
{
"output_type": "execute_result",
"execution_count": 5,
"data": {
"text/plain": [
"[:!, :!=, :!~, :%, :*, :+, :+@, :-@, :<, :<<, :<=, :<=>, :==, :===, :=~, :>, :>=, :[], :[]=, :__binding__, :__id__, :__send__, :ascii_only?, :b, :between?, :bytes, :bytesize, :byteslice, :capitalize, :capitalize!, :casecmp, :center, :chars, :chomp, :chomp!, :chop, :chop!, :chr, :class, :clear, :clone, :codepoints, :concat, :count, :crypt, :define_singleton_method, :delete, :delete!, :display, :downcase, :downcase!, :dump, :dup, :each_byte, :each_char, :each_codepoint, :each_line, :empty?, :encode, :encode!, :encoding, :end_with?, :enum_for, :eql?, :equal?, :extend, :force_encoding, :freeze, :frozen?, :getbyte, :gsub, :gsub!, :hash, :hex, :include?, :index, :insert, :inspect, :instance_eval, :instance_exec, :instance_of?, :instance_variable_defined?, :instance_variable_get, :instance_variable_set, :instance_variables, :intern, :is_a?, :itself, :kind_of?, :length, :lines, :ljust, :lstrip, :lstrip!, :match, :method, :methods, :next, :next!, :nil?, :object_id, :oct, :ord, :partition, :prepend, :pretty_inspect, :pretty_print, :pretty_print_cycle, :pretty_print_inspect, :pretty_print_instance_variables, :private_methods, :protected_methods, :pry, :public_method, :public_methods, :public_send, :remove_instance_variable, :replace, :respond_to?, :reverse, :reverse!, :rindex, :rjust, :rpartition, :rstrip, :rstrip!, :scan, :scrub, :scrub!, :send, :setbyte, :shellescape, :shellsplit, :singleton_class, :singleton_method, :singleton_methods, :size, :slice, :slice!, :split, :squeeze, :squeeze!, :start_with?, :strip, :strip!, :sub, :sub!, :succ, :succ!, :sum, :swapcase, :swapcase!, :taint, :tainted?, :tap, :to_c, :to_enum, :to_f, :to_i, :to_json, :to_json_raw, :to_json_raw_object, :to_r, :to_s, :to_str, :to_sym, :tr, :tr!, :tr_s, :tr_s!, :trust, :unicode_normalize, :unicode_normalize!, :unicode_normalized?, :unpack, :untaint, :untrust, :untrusted?, :upcase, :upcase!, :upto, :valid_encoding?]"
]
},
"metadata": {}
}
],
"execution_count": 5,
"metadata": {
"collapsed": false,
"outputHidden": false,
"inputHidden": false
}
},
{
"cell_type": "code",
"source": [
"puts 'test'.methods.sort"
],
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[:!, :!=, :!~, :%, :*, :+, :+@, :-@, :<, :<<, :<=, :<=>, :==, :===, :=~, :>, :>=, :[], :[]=, :__binding__, :__id__, :__send__, :ascii_only?, :b, :between?, :bytes, :bytesize, :byteslice, :capitalize, :capitalize!, :casecmp, :center, :chars, :chomp, :chomp!, :chop, :chop!, :chr, :class, :clear, :clone, :codepoints, :concat, :count, :crypt, :define_singleton_method, :delete, :delete!, :display, :downcase, :downcase!, :dump, :dup, :each_byte, :each_char, :each_codepoint, :each_line, :empty?, :encode, :encode!, :encoding, :end_with?, :enum_for, :eql?, :equal?, :extend, :force_encoding, :freeze, :frozen?, :getbyte, :gsub, :gsub!, :hash, :hex, :include?, :index, :insert, :inspect, :instance_eval, :instance_exec, :instance_of?, :instance_variable_defined?, :instance_variable_get, :instance_variable_set, :instance_variables, :intern, :is_a?, :itself, :kind_of?, :length, :lines, :ljust, :lstrip, :lstrip!, :match, :method, :methods, :next, :next!, :nil?, :object_id, :oct, :ord, :partition, :prepend, :pretty_inspect, :pretty_print, :pretty_print_cycle, :pretty_print_inspect, :pretty_print_instance_variables, :private_methods, :protected_methods, :pry, :public_method, :public_methods, :public_send, :remove_instance_variable, :replace, :respond_to?, :reverse, :reverse!, :rindex, :rjust, :rpartition, :rstrip, :rstrip!, :scan, :scrub, :scrub!, :send, :setbyte, :shellescape, :shellsplit, :singleton_class, :singleton_method, :singleton_methods, :size, :slice, :slice!, :split, :squeeze, :squeeze!, :start_with?, :strip, :strip!, :sub, :sub!, :succ, :succ!, :sum, :swapcase, :swapcase!, :taint, :tainted?, :tap, :to_c, :to_enum, :to_f, :to_i, :to_json, :to_json_raw, :to_json_raw_object, :to_r, :to_s, :to_str, :to_sym, :tr, :tr!, :tr_s, :tr_s!, :trust, :unicode_normalize, :unicode_normalize!, :unicode_normalized?, :unpack, :untaint, :untrust, :untrusted?, :upcase, :upcase!, :upto, :valid_encoding?]\n"
]
}
],
"execution_count": 6,
"metadata": {
"collapsed": false,
"outputHidden": false,
"inputHidden": false
}
},
{
"cell_type": "code",
"source": [
"'test'.methods.sort.each { |m| puts m };nil"
],
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"!\n",
"!=\n",
"!~\n",
"%\n",
"*\n",
"+\n",
"+@\n",
"-@\n",
"<\n",
"<<\n",
"<=\n",
"<=>\n",
"==\n",
"===\n",
"=~\n",
">\n",
">=\n",
"[]\n",
"[]=\n",
"__binding__\n",
"__id__\n",
"__send__\n",
"ascii_only?\n",
"b\n",
"between?\n",
"bytes\n",
"bytesize\n",
"byteslice\n",
"capitalize\n",
"capitalize!\n",
"casecmp\n",
"center\n",
"chars\n",
"chomp\n",
"chomp!\n",
"chop\n",
"chop!\n",
"chr\n",
"class\n",
"clear\n",
"clone\n",
"codepoints\n",
"concat\n",
"count\n",
"crypt\n",
"define_singleton_method\n",
"delete\n",
"delete!\n",
"display\n",
"downcase\n",
"downcase!\n",
"dump\n",
"dup\n",
"each_byte\n",
"each_char\n",
"each_codepoint\n",
"each_line\n",
"empty?\n",
"encode\n",
"encode!\n",
"encoding\n",
"end_with?\n",
"enum_for\n",
"eql?\n",
"equal?\n",
"extend\n",
"force_encoding\n",
"freeze\n",
"frozen?\n",
"getbyte\n",
"gsub\n",
"gsub!\n",
"hash\n",
"hex\n",
"include?\n",
"index\n",
"insert\n",
"inspect\n",
"instance_eval\n",
"instance_exec\n",
"instance_of?\n",
"instance_variable_defined?\n",
"instance_variable_get\n",
"instance_variable_set\n",
"instance_variables\n",
"intern\n",
"is_a?\n",
"itself\n",
"kind_of?\n",
"length\n",
"lines\n",
"ljust\n",
"lstrip\n",
"lstrip!\n",
"match\n",
"method\n",
"methods\n",
"next\n",
"next!\n",
"nil?\n",
"object_id\n",
"oct\n",
"ord\n",
"partition\n",
"prepend\n",
"pretty_inspect\n",
"pretty_print\n",
"pretty_print_cycle\n",
"pretty_print_inspect\n",
"pretty_print_instance_variables\n",
"private_methods\n",
"protected_methods\n",
"pry\n",
"public_method\n",
"public_methods\n",
"public_send\n",
"remove_instance_variable\n",
"replace\n",
"respond_to?\n",
"reverse\n",
"reverse!\n",
"rindex\n",
"rjust\n",
"rpartition\n",
"rstrip\n",
"rstrip!\n",
"scan\n",
"scrub\n",
"scrub!\n",
"send\n",
"setbyte\n",
"shellescape\n",
"shellsplit\n",
"singleton_class\n",
"singleton_method\n",
"singleton_methods\n",
"size\n",
"slice\n",
"slice!\n",
"split\n",
"squeeze\n",
"squeeze!\n",
"start_with?\n",
"strip\n",
"strip!\n",
"sub\n",
"sub!\n",
"succ\n",
"succ!\n",
"sum\n",
"swapcase\n",
"swapcase!\n",
"taint\n",
"tainted?\n",
"tap\n",
"to_c\n",
"to_enum\n",
"to_f\n",
"to_i\n",
"to_json\n",
"to_json_raw\n",
"to_json_raw_object\n",
"to_r\n",
"to_s\n",
"to_str\n",
"to_sym\n",
"tr\n",
"tr!\n",
"tr_s\n",
"tr_s!\n",
"trust\n",
"unicode_normalize\n",
"unicode_normalize!\n",
"unicode_normalized?\n",
"unpack\n",
"untaint\n",
"untrust\n",
"untrusted?\n",
"upcase\n",
"upcase!\n",
"upto\n",
"valid_encoding?\n"
]
}
],
"execution_count": 10,
"metadata": {
"collapsed": false,
"outputHidden": false,
"inputHidden": false
}
},
{
"cell_type": "code",
"source": [
"require 'date'\n",
"Time.new.utc"
],
"outputs": [
{
"output_type": "execute_result",
"execution_count": 7,
"data": {
"text/plain": [
"2017-02-24 21:05:37 UTC"
]
},
"metadata": {}
}
],
"execution_count": 7,
"metadata": {
"collapsed": false,
"outputHidden": false,
"inputHidden": false
}
},
{
"cell_type": "code",
"source": [
"require 'active_support/inflector'\n",
"'Time'.pluralize"
],
"outputs": [
{
"output_type": "execute_result",
"execution_count": 10,
"data": {
"text/plain": [
"\"Times\""
]
},
"metadata": {}
}
],
"execution_count": 10,
"metadata": {
"collapsed": false,
"outputHidden": false,
"inputHidden": false
}
},
{
"cell_type": "code",
"source": [
"require 'active_support/core_ext'\n",
"[].present?"
],
"outputs": [
{
"output_type": "execute_result",
"execution_count": 11,
"data": {
"text/plain": [
"false"
]
},
"metadata": {}
}
],
"execution_count": 11,
"metadata": {
"collapsed": false,
"outputHidden": false,
"inputHidden": false
}
},
{
"cell_type": "code",
"source": [],
"outputs": [],
"execution_count": null,
"metadata": {
"collapsed": false,
"outputHidden": false,
"inputHidden": false
}
}
],
"metadata": {
"kernelspec": {
"name": "ruby",
"language": "ruby",
"display_name": "Ruby 2.3.1"
},
"kernel_info": {
"name": "ruby"
},
"language_info": {
"name": "ruby",
"version": "2.3.1",
"mimetype": "application/x-ruby",
"file_extension": ".rb"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment