Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View patrickdavey's full-sized avatar

Patrick Davey patrickdavey

View GitHub Profile
@patrickdavey
patrickdavey / rspec-syntax-cheat-sheet.rb
Created October 26, 2012 19:46 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# 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")
@patrickdavey
patrickdavey / gist:5809735
Created June 18, 2013 21:44
script to clone railscasts episodes
#!/usr/bin/env ruby
require "rubygems"
require "octokit" # gem install octokit
1.upto(5) do |page|
Octokit.repositories("railscasts", page: page, per_page: 100).each do |repo|
system "git clone git://github.com/railscasts/#{repo.name}"
end
end
@patrickdavey
patrickdavey / gist:6929052
Created October 11, 2013 03:14
simple dynamic robots.txt
require 'robots_txt_generator'
AppName::Application.routes.draw do
[snip]
match '/robots.txt' => RobotsTxtGenerator
end
class RobotsTxtGenerator
# Disallow everything for all other environments.
@patrickdavey
patrickdavey / gist:10216075
Last active August 29, 2015 13:58
Interested in Livestream / VideoCast / Hangout / ... of RRobots #battlearubyist
Please :+1: this gist if you're not going to make the http://talks.ruby.org.nz/2014/tanks-guns-rrobots/ Christchurch Ruby talk in person but are keen to submit a robot.
We're not sure whether we'll get organised in time, the meetup is happening on Thursday 17th April at 19:00 New Zealand time.. if we get enough +1's + entries we'll be more motivated ;)
Thanks!
@patrickdavey
patrickdavey / refinery_edge_bootstrap
Last active August 29, 2015 14:07
Applies bootstrap3 and some sensible defaults for heroku
# forked from http://refinerycms.com/t/edge
require 'rbconfig'
# We want to ensure that you have an ExecJS runtime available!
begin
require 'execjs'
rescue LoadError
abort "ExecJS is not installed. Please re-start the installer after running:\ngem install execjs"
end
ETHON: Libcurl initialized
/Users/patrickdavey/.rvm/gems/ruby-2.2.1/gems/ethon-0.7.3/lib/ethon/easy/operations.rb:23: [BUG] Segmentation fault at 0x00000000000110
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin13]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
#!/bin/bash
# log into your server
ssh root@[server ipaddress]
# change root password
passwd
# update all packages and operating system
apt-get update && apt-get --yes upgrade
live_loop :flibble do
sample :ambi_choir, rate: 0.3
sample :bd_haus, rate: 1
sleep 1
end
@patrickdavey
patrickdavey / App.vue
Created March 6, 2019 03:39
simple app to show destroy on vue-ckeditor2
<template>
<div>
<vue-ckeditor
v-model="content"
:key="myKey"
:id="myKey"
:config="config" />
<button @click="updateKey">Update Key</button>
<span :key="blah['id']" v-for="blah in instances">
{{ blah["id"] }}
@patrickdavey
patrickdavey / gist:cc0cc4738dd14b780ffa9c1b6ba7c6a8
Last active March 24, 2021 20:57
current apache2 logrotate
/var/log/apache2/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate