Skip to content

Instantly share code, notes, and snippets.

@wookiehangover
wookiehangover / gist:39818205cc5ca26a5006
Last active August 29, 2015 14:05
Motherbrain Rounds and Question Schema

Geeks Who Drink: Motherbrain Rounds and Questions Schema

Currently there are several changes to Motherbrain needed to accomodate the mobile and Quizmaster applications.

Round Types

During the course of a quiz, it's necessary for the mobile app and Quizmaster dashboard to be able to determine the type of Round being played.

These are the following round types:

@Akkuma
Akkuma / application.coffee
Created April 20, 2012 14:19
Tower.js Passport Example
passport = require 'passport'
googOID = require('passport-google').Strategy
steamOID = require('passport-steam').Strategy
passport.use new steamOID
returnURL: 'http://localhost:3000/auth/steam/return'
, realm: 'http://localhost:3000'
, () -> console.log arguments
passport.use new googOID
@acao
acao / users_controller.js
Created May 14, 2012 21:13
RailwayJS Sample Users controller file
var bcrypt = require('bcrypt');
load('application');
before(loadUser, {only: ['show', 'edit', 'update', 'destroy']});
before(loadGroups, {only: ['new', 'edit']});
action('new', function () {
this.title = 'New user';
this.user = new User;
@KevinTriplett
KevinTriplett / capybara_wait_until.rb
Last active December 14, 2015 12:38
Adding back the #wait_until to Capybara v2+ gem. Can probably be adapted for cucumber tests.
# add this file capybara_wait_until.rb to your /test directory
module Capybara
class Session
##
#
# Retry executing the block until a truthy result is returned or the timeout time is exceeded
#
# @param [Integer] timeout The amount of seconds to retry executing the given block
#
@mhuggins
mhuggins / Gemfile
Last active December 31, 2015 04:49
Generate graphs in PDFs
source 'https://rubygems.org'
gem 'prawn'
gem 'gruff'
@brandonc
brandonc / batch_job_stateful.rb
Created February 18, 2016 23:05
Attach batch progress tracking to a model via concern
module BatchJobStateful
extend ActiveSupport::Concern
included do
field :current_batch_id, type: String
field :last_batch_total, type: Integer
field :last_batch_failures, type: Integer
field :last_batch_created_at, type: Time
field :last_batch_completed_at, type: Time
end
@sebmarkbage
sebmarkbage / react-warning-descriptors.md
Created February 11, 2014 02:10
React Warning - Invalid access to component property

You're probably getting this warning because you're accessing methods on a component before it gets mounted. This will be soon be an unsupported use case.

The component that gets created by invoking the convenience constructor MyComponent(props, children) or using the JSX syntax <MyComponent /> is not guaranteed to be the instance that actually gets mounted. It's a description of what the actual mounted instance should look like.

Anti-pattern:

The component also doesn't have access to state or other important information such as the final props. As a consequence you shouldn't be calling custom methods on this object.

var MyComponent = React.createClass({
@mndoci
mndoci / iam_fog.rb
Created May 29, 2011 03:48 — forked from zapnap/iam_fog.rb
Using Amazon IAM with Fog (example)
# via http://blog.zerosum.org/2011/03/02/better-aws-access-control-with-iam-and-fog.html
require 'fog'
username = 'testuser'
bucket = 'uniquebucketname1234'
aws_credentials = {
:aws_access_key_id => 'YOUR-ACCESS-KEY-ID',
:aws_secret_access_key => 'YOUR-SECRET-ACCESS-KEY'
@kagemusha
kagemusha / gist:1504633
Created December 21, 2011 04:47
Migrate from Mongo to Postgres in Rails 3.1
Tested on: Rails 3.1, Mongoid 2.0.1, pg 0.12.0 gem
Migrate from Mongo to PG
1. remove mongoid gem
2. add pg gem
3. in application.rb re-add ActiveRecord
4. for all models
- inherit from ActiveRecord::Base
- get rid of Mongoid:Document line
- make migrations and put fields there
@killercup
killercup / Gulpfile.coffee
Created September 14, 2014 12:28
A Gulp config for compiling CoffeeScript and Less using Webpack with a custom vendor.js and Hot Module Replacement for Less and React.js
# # Frontend Build Process
path = require('path')
gulp = require('gulp')
gutil = require('gulp-util')
plumber = require('gulp-plumber')
webpack = require("webpack")
# ## CONSTS