Skip to content

Instantly share code, notes, and snippets.

View robbyoconnor's full-sized avatar
🏳️‍🌈
🙃 🙂 (=

Robby O'Connor robbyoconnor

🏳️‍🌈
🙃 🙂 (=
View GitHub Profile
'use strict';
export default function (question) {
var rl = require('readline');
var r = rl.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
return new Promise((resolve, error) => {
#include <iostream>
#include <vector>
#include <random>
using namespace std;
/* Returns whether a list is sorted */
bool isSorted(vector<int> & list);
/* Sorts a list using the standard merge sort algorithm everyone learns in school (requires O(nlog(n)) space) */

Keybase proof

I hereby claim:

  • I am robbyoconnor on github.
  • I am robbyoconnor (https://keybase.io/robbyoconnor) on keybase.
  • I have a public key whose fingerprint is 0C94 BEF5 AF7D 93D9 C4AA 0A79 865F A85A AF5A 21A4

To claim this, I am signing this object:

@robbyoconnor
robbyoconnor / .bashrc
Last active August 29, 2015 14:17
git config
alias gco='git checkout'
@robbyoconnor
robbyoconnor / pr.md
Last active August 29, 2015 14:16 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (dir) {
return require('serve-static')(require('path').resolve(dir));
};
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
#!/bin/bash
if [[ $EUID != 0 ]] ; then
echo This must be run as root!
exit 1
fi
for xhci in /sys/bus/pci/drivers/?hci_hcd ; do
if ! cd $xhci ; then
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
class Address < ActiveRecord::Base
has_many :phonings, :as => :phonable
has_many :phone_numbers, :through => :phonings
accepts_nested_attributes_for :phonings, :allow_destroy => true
end
class ArticlesController < ApplicationController
# with ActiveRecord
def create
@article = Article.new(params[:article])
if @article.save
redirect_to @article, notice: 'Article created!'
else
render :new
end