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.
ANSI_COLOR_CODE = { | |
0 => 'black', | |
1 => 'red', | |
2 => 'green', | |
3 => 'yellow', | |
4 => 'blue', | |
5 => 'purple', | |
6 => 'cyan', | |
7 => 'white' | |
} |
<?php | |
/* | |
Plugin Name: OLark | |
Description: Live Chat | |
Version: 1.0 | |
Author: Michael Bianco | |
Author URI: http://github.com/iloveitaly/ | |
*/ | |
function admin_page () { |
//basic zopim widget code, from their site | |
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s= | |
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set. | |
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8'); | |
$.src='//v2.zopim.com/?26Smu9lv0NXQEOOg8IAZrMPh9yQstAcV';z.t=+new Date;$. | |
type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script'); | |
//make sure zopim does not show till we know we have department agents | |
var intial_zopim_hiding_done = false; |
<!--Start of Zopim Live Chat Script--> | |
< script type = "text/javascript" > | |
window.$zopim || (function (d, s) { | |
var z = $zopim = function (c) { | |
z._.push(c) | |
}, $ = z.s = | |
d.createElement(s), | |
e = d.getElementsByTagName(s)[0]; | |
z.set = function (o) { | |
z.set. |
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.
# Avoid annoying ActionController::UnknownHttpMethod exceptions like: | |
# | |
# ActionController::UnknownHttpMethod) "CONNECT, accepted HTTP methods are get, head, put, post, delete, and options" | |
# | |
# Install this file in app/metal and these requests will receive a 405 | |
# "Method Not Allowed" status and will be logged under `info'. | |
class IgnoreUnknownHttpMethod | |
def self.call(env) | |
[ | |
if ActionController::Request::HTTP_METHODS.include?(env["REQUEST_METHOD"].downcase) |
#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)
Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.
(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)
##Option 1: Using jQuery 1.7's $.Callbacks() feature:
module RecognizePath | |
def recognize_path(path, options) | |
recognized_path = Rails.application.routes.recognize_path(path, options) | |
# We have a route that catches everything and sends it to 'errors#not_found', you might | |
# need to rescue ActionController::RoutingError | |
return recognized_path unless recognized_path.slice(:controller, :action) == {controller: 'errors', action: 'not_found'} | |
# The main app didn't recognize the path, try the engines... | |
Rails.application.railties.engines.each do |engine| |
require 'rubygems' | |
require 'sinatra' | |
require 'net-ldap' | |
require 'digest/sha1' | |
require 'base64' | |
require 'haml' | |
LDAP_HOST = 'localhost' | |
ADMIN_DN = 'cn=admin,dc=company,dc=com' |