Skip to content

Instantly share code, notes, and snippets.

View coderberry's full-sized avatar

Eric Berry coderberry

View GitHub Profile
@coderberry
coderberry / CaptchaConverter.groovy
Created October 17, 2011 00:45
CaptchaConverter.groovy
package com.berry
import com.berry.BCrypt
import grails.converters.JSON
class CaptchaController {
def index = {
// Generate the SALT to be used for encryption and place in session
@coderberry
coderberry / data.json
Created October 17, 2011 00:46
data.json
{
"text":"heart",
"images":[
{
"hash":"$2a$10$GTcG7U1rt7XFBi4JVImT2Oo.E3D8FCzha2772XuXm7v28Kx2LNL5S",
"file":"images/captchaImages/99.png"
},
{
"hash":"$2a$10$GTcG7U1rt7XFBi4JVImT2Oa5Y/I/cXOUj30kffPqyX0qxTnAACX6O",
"file":"images/captchaImages/43.png"
<!-- PLACE IN HEADER -->
<script type="text/javascript" src="${resource(dir:'js',file:'jquery.simpleCaptcha-0.2.js')}"></script>
<style type="text/css">
img.simpleCaptcha {
margin: 2px !important;
cursor: pointer;
}
img.simpleCaptchaSelected {
margin-bottom: 0px;
border-bottom: 2px solid red;
@coderberry
coderberry / Ruby.sublime-settings
Created October 17, 2011 16:34
Ruby.sublime-settings
{
// The number of spaces a tab is considered equal to
"tab_size": 2,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": true,
"font_face": "Droid Sans Mono",
"font_size": 15,
@coderberry
coderberry / breakout.coffee
Created October 23, 2011 20:24
breakout.coffee
ctx = null
$(document).ready ->
# get a reference to the canvas
ctx = $('#canvas')[0].getContext("2d")
# draw a circle
ctx.beginPath()
ctx.arc(75, 75, 10, 0, Math.PI*2, true)
ctx.closePath()
@coderberry
coderberry / breakout.html
Created October 23, 2011 20:28
breakout.html
<!DOCTYPE html>
<html>
<head>
<title>Breakout</title>
<meta charset="utf-8" />
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="breakout.js"></script>
</head>
<body>
@coderberry
coderberry / application_helper.rb
Created November 9, 2011 16:19
application_helper.rb
module ApplicationHelper
# Helper method to wrap an input field for twitter bootstrap
# @param [Object] model_instance Instanciated model
# @param [Symbol] field_name Attribute name of the field being referred to in this block
# @param [Hash] options Set of options. See example.
#
# @example
# <!--
# Available options:
@coderberry
coderberry / backbone-websql.js
Created March 14, 2012 04:01
backbone-websql.js
// ====== [UTILS] ======
//function for generating "random" id of objects in DB
function S4() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function guid() {
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}
@coderberry
coderberry / example.gsp
Created April 17, 2012 17:18
example.gsp
<ab:splitTest name="My First Split Test">
This is my default content that appears when the test is disabled.
</ab:splitTest>
@coderberry
coderberry / ExampleController.groovy
Created April 17, 2012 17:24
ExampleController.groovy
class ExampleController {
def splitTestService
def converted() {
// Mark split test with name 'My First Split Test' as converted
splitTestService.markTestAsConverted('My First Split Test')
}
}