Skip to content

Instantly share code, notes, and snippets.

@monicao
monicao / application.html.erb
Created March 31, 2011 17:31
helps with passing the request forgery protection token back to rails when using ajax with jQuery
In all layout files (ex. views/layouts/application.html.erb)
<%= javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.inspect};" if protect_against_forgery? -%>
@monicao
monicao / application_controller.rb
Created May 25, 2011 19:14
Devise login redirect for authentication systems with multiple roles
def after_sign_in_path_for(resource)
if current_user.admin?
stored_location_for(:user) || admin_projects_url
elsif current_user.artist?
stored_location_for(:user) || artists_dashboard_url
elsif current_user.client?
stored_location_for(:user) || dashboard_url
else
stored_location_for(:user) || root_url
end
@monicao
monicao / hotcocoa.txt
Created June 4, 2011 04:29
Hotcocoa installation attempt
Running OSX 10.6.7
minimo:hello monica$ macruby -v
MacRuby 0.10 (ruby 1.9.2) [universal-darwin10.0, x86_64]
minimo:hello monica$ macrake --version
rake, version 0.8.7
minimo:projects monica$ git clone https://github.com/ferrous26/hotcocoa.git
Cloning into hotcocoa...
@monicao
monicao / swfupload_error.txt
Created January 18, 2012 19:56
SWFUpload error
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for standard upload. Starting upload to https://s3.amazonaws.com/discuss-dev for File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0 Bytes: 0. Total: 150904
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 131072. Total: 150904
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 150904. Total: 150904
SWF DEBUG: Event: uploadError: HTTP ERROR : File ID: SWFUpload_0_0. HTTP Status: 400.
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
@monicao
monicao / drawing.html
Created June 6, 2012 19:18
Zach's super awesome rectangle drawing algo
<html>
<head>
<title>Drawing</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="drawing.js"></script>
<style type="text/css">
#wrapper {
width: 100%;
height: 100%;
@monicao
monicao / ajax_setup.coffee
Created September 9, 2012 15:26
Make $.ajax requests include the authenticity token
$.ajaxSetup(
beforeSend: (xhr, settings) ->
return if (settings.crossDomain || settings.type == "GET")
token = $('meta[name="csrf-token"]').attr('content')
xhr.setRequestHeader('X-CSRF-Token', token) if token
)
@monicao
monicao / backbone_view.coffee
Created December 11, 2012 15:40
Backbone Child Views
# View support class. Put all view helpers here.
Support.View = (options) ->
@children = []
Backbone.View.apply(this, [options])
_.extend(Support.View.prototype, Backbone.View.prototype, {
###
# COMPOSITE VIEWS
# Ensures all event bindings are unbound when a child view is removed.
# Source: Backbone on Rails book
@monicao
monicao / home.html
Last active December 14, 2015 13:28
<html>
<head>
<title>Things Aaron made</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link href='http://fonts.googleapis.com/css?family=Sintony' rel='stylesheet' type='text/css'>
</head>
<body>
<nav>
<ul>
@monicao
monicao / style.css
Last active December 14, 2015 13:28
body {
margin: 0;
}
nav {
/*padding: 4px 0 8px 0;*/
margin-top: 20px;
width: 100%;
height: 40px;
line-height: 40px;
@monicao
monicao / gist:5102729
Last active December 14, 2015 14:48
Git Cheat Sheet
cd ~/Documents/resume
# if you are using your computer
git config --global user.name "Monica Olinescu"
git config --global user.email "monica.olinescu@gmail.com"
# if you are the imacs
cd ~/Documents/resume
git config user.name "Monica Olinescu"