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.
@implementation UIImage (scale) | |
/** | |
* Scales an image to fit within a bounds with a size governed by | |
* the passed size. Also keeps the aspect ratio. | |
* | |
* Switch MIN to MAX for aspect fill instead of fit. | |
* | |
* @param newSize the size of the bounds the image must fit within. | |
* @return a new scaled image. |
/** | |
* Netflix | |
* | |
* A program that emits an IR singal to startup | |
* Netflix on a smart TV, lights up an array of | |
* LED lights and signals a control unit that a | |
* button press has occurred using MQTT. | |
* | |
* Hardware: Particle Photon | |
* Concept Usage: Netflix and Chill Button |
#!/usr/bin/env bash | |
# The MIT License (MIT) | |
# | |
# Copyright (c) 2015 Adafruit Industries | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
# Create a directory | |
mkdir ~/tmux-install | |
cd ~/tmux-install | |
# Get the files | |
curl -OL https://www.openssl.org/source/openssl-1.0.2l.tar.gz | |
curl -OL https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz | |
curl -OL https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz | |
# Extract them |
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.
When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.
This is enabled by adding the
ForwardAgent yes
option to any of your Host
entries in ~/.ssh/config
(or alternatively with the -A
option). Don't set this option in a wildcard Host *
section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.
CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS=--with-openssl-dir=$(brew --prefix openssl) rbenv install |
require 'digest' | |
require 'net/http' | |
password = ARGV[0] || 'Password' | |
hashed_password = Digest::SHA1.hexdigest password | |
# SHA1 hashes will be 40 characters long | |
prefix = hashed_password[0, 5].to_s.upcase # Get the first 5 characters | |
suffix = hashed_password[5..-1].to_s.upcase # Get the remaining 35 characters |
require 'base64' | |
class SpanContext | |
def initialize(trace_id: '', span_id: '') | |
raise RuntimeError 'trace_id must be 16 bytes' unless trace_id.size == 16 | |
raise RuntimeError 'span_id must be 8 bytes' unless span_id.size == 8 | |
@version = [0] | |
@trace_id = [0] + trace_id.bytes # field id 0 + trace_id | |
@span_id = [1] + span_id.bytes # field id 1 + span_id |
/* | |
* Add a specific Cloudflare edge cache HTTP header to each HTTP response | |
* preventing defined pages from being cached at the edge. This is done | |
* selectively since some pages require dynamic content based on external | |
* factors such as geographic location of the request. All other static | |
* content will continue to be cached (i.e. JavaScript, CSS, images). | |
* | |
* To control the caching behaviour at the edge add a custom metadata field | |
* to the page: | |
* |