This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# JSON-encoded error and redirect results for Devise controllers. | |
# This overrides an internal method of Devise, so be careful when updating Devise! | |
# | |
# Usage: | |
# | |
# class Users::RegistrationsController < Devise::RegistrationsController | |
# include DeviseJsonAdapter | |
# end | |
# | |
# devise_for :users, :controllers => { :registrations => "users/registrations" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <QuartzCore/QuartzCore.h> | |
// generate a UIColor from rgb and alpha values | |
#define RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a] | |
#define RGB(r, g, b) RGBA(r, g, b, 1.0) | |
// generate a UIColor | |
#define GRAYSCALEA(rgb, a) RGBA(rgb, rgb, rgb, a) | |
#define GRAYSCALE(rgb) GRAYSCALEA(rgb, 1.0) | |
// generate a UIColor from a hex and an alpha value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'prawn' | |
require 'barby' | |
require 'barby/barcode/qr_code' | |
require 'barby/outputter/prawn_outputter' | |
Prawn::Document.generate("barcode.pdf") do |pdf| | |
pdf.bounding_box([0, pdf.cursor], :width => 100, :height => 100) do | |
Barby::QrCode.new("hello", :level => :h).annotate_pdf(pdf) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
require 'keychain' | |
class Scraper | |
def initialize(url) | |
@url = url | |
@flows = [] | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
// Licensed under MIT (http://opensource.org/licenses/MIT) | |
// | |
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit. | |
#import <objc/runtime.h> | |
#import <objc/message.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum SizeMatching { | |
case Width, Height, Both, None | |
} | |
class IKScrollView: UIScrollView { | |
//MARK: - Outlets | |
@IBOutlet private var contentView: UIView? | |
//MARK: - Properties | |
@IBInspectable var sizeMatching = SizeMatching.Width |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sudo ruby | |
# | |
# revealer.rb -- Deobfuscate GHE .rb files. | |
# | |
# This is simple: | |
# Every obfuscated file in the GHE VM contains the following code: | |
# | |
# > require "ruby_concealer.so" | |
# > __ruby_concealer__ "..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ITERATION=1 | |
EXTENSION="mp4" | |
FILENAME="$HOME/Desktop/Simulator Recording.$EXTENSION" | |
while [ -e "$FILENAME" ] | |
do | |
ITERATION=$((ITERATION+1)) | |
FILENAME="$HOME/Desktop/Simulator Recording $ITERATION.$EXTENSION" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Check for the existence of an .xcoderc in the root of a project and update the DEVELOPER_DIR | |
# to point to that specific version of Xcode. Update Carthage dependencies as well. | |
# | |
# This is useful for all the switching between Xcode 10.x and 11.x as I am doing presently. | |
# | |
# Usage: | |
# xcode_switch [--no-bootstrap] [version_number] | |
# |
OlderNewer