Skip to content

Instantly share code, notes, and snippets.

@kenyonj
kenyonj / Hello
Created March 5, 2014 22:51
Test Gist
testing
class Url < ActiveRecord::Base
before_create :generate_unique_token, :escape_original_url
validates :original_url, presence: true
validate :check_if_url_is_valid
def to_param
token
end
@kenyonj
kenyonj / discussions_controller.rb
Created April 22, 2014 20:04
Discussions_Controller
class DiscussionsController < ApplicationController
before_action :authorize, only: [:new, :create]
def new
@discussion_form = DiscussionForm.new
@types = ["Image", "Document", "Code", "Video", "Audio"]
end
def show
@discussion = Discussion.find_by(token: params[:id])
func! Fire(name)
let command = "curl -u 2cee4028ecfc5a0fed2325b150565714961c429e:X -H \'Content-Type: application/json\' -d \'{\"message\":{\"body\":" . a:name . "\"}}\' https://metis7.campfirenow.com/room/584821/speak.json"
call system(command)
" echom "Hello! My name is:"
" echom a:name
endfunc
command! Hello :call Fire("test")
" command! -nargs=1 Fire call s:Fire(<f-args>)
class SessionsController < ApplicationController
skip_before_action :require_login, only: [:new, :create]
def new
end
def create
@user = authenticate_session(session_params, email_or_username: [:email, :username])
if sign_in(@user)
describe "User views settings for a form", ->
it "they export the form to JSON", ->
create('form').then (form) ->
visit("/f/#{form.get("id")}/edit").then ->
click(".ember-view a:contains('Export')").then ->
click(".button.export-to-json").then ->
expectedURL = "/f/#{form.get("id")}.json"
expect(currentURL()).to.equal(expectedURL, "expected #{currentURL()} to equal #{expectedURL}")
var _ = require('lodash'),
concat = require('gulp-concat'),
debug = require('gulp-debug'),
gulp = require('gulp'),
ignore = require('gulp-ignore'),
jshint = require('gulp-jshint'),
karma = require('karma').server,
htmlmin = require('gulp-htmlmin'),
includeSource = require('gulp-include-source'),
minifyCss = require('gulp-minify-css'),
@kenyonj
kenyonj / gpair-gsolo
Last active August 29, 2015 14:07
defining gpair() and gsolo()
# set gitconfig.local keys and define gpair() and gsolo()
gh_name=("${(s/ /)$(echo `git config user.name`)}")
gh_email=("${(s/@/)$(echo `git config user.email`)}")
gh_co_domain=$(echo `git config company.domain`)
# set the company email domain name in gitconfig.local, only do this once
if [[ $gh_co_domain == "" ]]; then
echo "\nPlease enter your company email domain name: [thoughtbot.com] "
read co_domain
# set gitconfig.local keys and define gpair() and gsolo()
gh_name=("${(s/ /)$(echo `git config user.name`)}")
gh_email=("${(s/@/)$(echo `git config user.email`)}")
gh_co_domain=$(echo `git config company.domain`)
# set the company email domain name in gitconfig.local, only do this once
if [[ $gh_co_domain == "" ]]; then
echo "\nPlease enter your company email domain name: [thoughtbot.com] "
read co_domain
append_to_zshrc() {
local text="$(sed 's/\\n//g' <<< $1)"
local zshrc
if [[ -w "$HOME/.zshrc.local" ]]; then
zshrc="$HOME/.zshrc.local"
else
zshrc="$HOME/.zshrc"
fi