The following block renders as ruby even though no language is specified:
def method
puts "a method!"
end
:~$ This text is always clobbered by the YARD parser
| ''' Add to jupyter_notebook_config.py | |
| import sys | |
| sys.path.append("/root/.jupyter/extensions/") | |
| c.NotebookApp.reraise_server_extension_failures = True | |
| c.NotebookApp.server_extensions = ['status'] | |
| ''' | |
| from notebook.utils import url_path_join | |
| from notebook.base.handlers import IPythonHandler |
| Jupyter.notification_area.get_widget("notebook").set_message("Extension loaded!"); |
| Jupyter.notebook.kernel.execute("puts 'hello world'", { | |
| iopub : { | |
| output : function(response) { | |
| console.log(response); | |
| } | |
| } | |
| }); |
| require 'zlib' | |
| require 'yard' | |
| require 'tmpdir' | |
| require 'stringio' | |
| require 'fileutils' | |
| require 'archive/tar/minitar' | |
| io = StringIO.new File.read('sequel-4.32.0.gem') | |
| catch :finished do |
The following block renders as ruby even though no language is specified:
def method
puts "a method!"
end
:~$ This text is always clobbered by the YARD parser
| # https://porkrind.org/missives/calling-applescript-from-ruby/ | |
| def osascript(script) | |
| system 'osascript', *script.split(/\n/).map { |line| ['-e', line] }.flatten | |
| end | |
| # http://stackoverflow.com/questions/5292204/macosx-get-foremost-window-title | |
| osascript <<-END | |
| global frontApp, frontAppName, windowTitle | |
| set windowTitle to "" |
| { | |
| "*" : [ | |
| ["exec", "echo 'exec works!'"], | |
| ["eval", "puts 'eval works!'"] | |
| ], | |
| "iruby" : [ | |
| ["eval", "puts 'gems work!'"], | |
| ["gem", "metaid"] | |
| ], | |
| "metaid": [ |
| def cropPicture(picture): | |
| smallPic = makeEmptyPicture(186,100) | |
| smallX = 0 | |
| smallY = 0 | |
| for x in range(59,244): | |
| smallX +=1 | |
| smallY = 0 | |
| for y in range(25,125): | |
| pixel = getPixel(picture,x,y) | |
| smallPicPixl = getPixel(smallPic,smallX,smallY) |
| require 'socket' | |
| class TCPSocket | |
| class << self | |
| def new host, *args, &block | |
| socket = super host, *args, &block | |
| # check whitelist, set indicator | |
| socket.instance_variable_set :@mypki, true # or false | |
| # return socket | |
| socket |
| require 'json' | |
| require 'watir' | |
| require 'seconds' | |
| if ARGS.empty? | |
| warn 'Please provide the Facebook user number and query string that will appear in every post (first name usually works)' | |
| exit | |
| end | |
| b = Watir::Browser.new |