Skip to content

Instantly share code, notes, and snippets.

View krevels's full-sized avatar

Kyril Revels krevels

  • Baltimore, MD USA
View GitHub Profile
class ballClock {
constructor() {
this.Min = [];
this.FiveMin = [];
this.Hour = [];
this.Main = [];
}
modeOneCycleLength(numberOfBalls) {
let available = new Array(numberOfBalls).fill(0).map((n, i) => i + 1);
#
# At CoverHound, we use conditional validations all over the form. However, there is no proper way to do
# this in Rails. Instead, we can provide an array of attributes (validated_fields attribute)
# and ensure they are the only ones to get validated.
#
module ConditionalValidations
attr_accessor :validated_fields
def field_is_required?(field)
@krevels
krevels / dns.rb
Created January 21, 2014 19:52
Refresh dreamhost dns entry with public ip
require 'uri'
require 'net/http'
DREAMHOST_API_KEY = ENV['DREAMHOST_API_KEY']
DNS_RECORD = "host.example.com"
TIMER = 600
abort "missing api key" if DREAMHOST_API_KEY.nil?
Process.daemon
@krevels
krevels / compass-watch
Created November 21, 2013 19:15
Gruntfiles
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
dist: {
options: {
@krevels
krevels / model.js
Created October 18, 2013 14:24
Mongoose: toJSON() on detached entities
var FeedSchema = new Schema({
title: String,
description: String,
link: String,
rss: String,
pubdate: Date,
updated: { type: Date, default: Date.now },
items: [{type: Schema.Types.ObjectId, ref: 'Item'}],
});