YARD CHEATSHEET http://yardoc.org
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
# USAGE: Hash.from_libxml(YOUR_XML_STRING) | |
require 'xml/libxml' | |
# adapted from | |
# http://movesonrails.com/articles/2008/02/25/libxml-for-active-resource-2-0 | |
class Hash | |
class << self | |
def from_libxml(xml, strict=true) | |
begin | |
XML.default_load_external_dtd = false |
# USAGE: Hash.from_xml:(YOUR_XML_STRING) | |
require 'nokogiri' | |
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297 | |
class Hash | |
class << self | |
def from_xml(xml_io) | |
begin | |
result = Nokogiri::XML(xml_io) | |
return { result.root.name.to_sym => xml_node_to_hash(result.root)} |
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# irb3 - Runs an IRB-esque prompt (but it's NOT really IRB!) over multiple | |
# versions of Ruby at once (using RVM) | |
# | |
# By Peter Cooper, BSD licensed | |
# | |
# Main dependency is term-ansicolor for each impl: | |
# rvm exec gem install term-ansicolor |
#!/usr/bin/env python | |
import cStringIO | |
import json | |
import pycurl | |
import os | |
import sys | |
########## | |
# configuration |
Edward Snowden answered questioned after a showing of CITIZENFOUR at the IETF93 meeting; this is a transcript of the video recording.
For more information, see the Internet Society article.
# in your app supervisor | |
:phx_dyn_dispatch = :ets.new(:phx_dyn_dispatch, [:named_table, :bag, :public]) | |
defmodule DynamicDispatch do | |
def register(group, plug, opts) do | |
true = :ets.insert(:phx_dyn_dispatch, {group, plug, opts}) | |
end | |
def unregister(group, plug) do |
(function (export) { | |
var App = export.App = {}; | |
// Stores state/current views of the App | |
App.state = {}; | |
App.state.currentPlayer = null; | |
// Model containing the player | |
App.PlayerModel = Backbone.Model.extend({}); | |
#!/bin/bash | |
# | |
# SSH Exit Codes | |
# | |
# Using SSH in scripting is pretty standard, but sometimes you want to stop execution of a script | |
# if a command inside an SSH session fails to exit cleanly (return 0). The key to remember is that | |
# the ssh command's exit code will be that of the *last executed* command inside the ssh session, just | |
# like a bash script ends with the exit code of the last command executed unless you specifically | |
# call exit. | |
# |