Skip to content

Instantly share code, notes, and snippets.

def create
@karretlink = Karretlink.new(params[:karretlink])
respond_to do |format|
if @karretlink.save
format.html { redirect_to @karretlink, notice: 'Your Karret was successfully created.' }
format.json { render json: @karretlink, status: :created, location: @karretlink }
else
flash.now.alert = "Something went wrong, Make sure to fill up everything. ( Make sure Karet's name have no space or special symbol)"
current_uri = request.env['PATH_INFO']
@jonpaul
jonpaul / highcharts.js
Created March 27, 2012 19:01
highcharts
<script type="text/javascript">
var chart = []; // globally available
$(document).ready(function() {
chart[0] = new Highcharts.Chart({
chart: {
renderTo: 'graphMonths',
defaultSeriesType: 'column'
},
title: {
text: ''
@jonpaul
jonpaul / legit
Created March 26, 2012 19:49
Git Legit
$ git switch <branch>
# Switches to branch. Stashes and restores unstaged changes.
$ git sync
# Syncronizes current branch. Auto-merge/rebase, un/stash.
$ git publish <branch>
# Publishes branch to remote server.
$ git unpublish <branch>
@jonpaul
jonpaul / monkey.rb
Created March 5, 2012 14:22
monkeypatched devisery
class Devise::PasswordsController < DeviseController
before_filter :mobile_layout
private
def mobile_layout
request.format = :mobile if android_device?
end
end
@jonpaul
jonpaul / rspec-syntax-cheat-sheet.rb
Created January 23, 2012 03:51 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
%p
%i
some text
TM
%i
some other text
(function($) {
var plugin = $['ui']['autocomplete'].prototype;
// store copies of the original plugin functions before overwriting
var functions = {};
for (var i in plugin) {
if (typeof(plugin[i]) === 'function') {
functions[i] = plugin[i];
}
}
@jonpaul
jonpaul / shell
Created December 20, 2011 18:18
rvm $PATH weirdness?
Last login: Tue Dec 20 12:50:04 on ttys003
zsh: command not found: rvm-prompt
╭─jon-paullussier@georges-imac ~ ‹›
╰─$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
zsh: command not found: rvm-prompt
╭─jon-paullussier@georges-imac ~ ‹›
╰─$ rvm use default
Using /Users/jon-paullussier/.rvm/gems/ruby-1.8.7-p352
def search
search_terms = params[:query]
simple_search_bucket(search_terms)
search_results = Hash.new
orgs_array.each do |uid|
search_results[uid] = {}
search_results[uid][:search] = Listing.search do
size 3
query {
= semantic_form_for @peon, :as => @peon, :url => registration_path(@peon) do |f|
=f.inputs :email, :email_confirmation, :password, :password_confirmation, :job_title, :first_name, :last_name
=f.inputs do
=f.input :organization_id, :as => :hidden, :input_html => {:value => "#{@organization.id}"}
=f.buttons