Skip to content

Instantly share code, notes, and snippets.

View chatman-media's full-sized avatar
:octocat:
Flow

Alexander Kireyev chatman-media

:octocat:
Flow
View GitHub Profile
if which rbenv &> /dev/null; then
RUBY_PROMPT="%{$fg_bold[blue]%}rbenv:%{$reset_color%}(%{$fg[green]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg_bold[blue]%})%{$reset_color%} "
fi
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s %{$reset_color%})"
PATH_PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$reset_color%}%{$fg[cyan]%}%c%{$reset_color%} '
GIT_PROMPT='%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
PROMPT="%{$fg[blue]%}%D{[%I:%M:%S]} $PATH_PROMPT$RUBY_PROMPT$GIT_PROMPT
class SectionsController < ApplicationController
before_action :set_section, only: [:show, :edit, :update, :delete, :destroy]
layout 'admin'
def index
@sections = Section.sorted
end
def show
@chatman-media
chatman-media / app.go
Created June 7, 2014 16:53
test simple app
package main
import (
"database/sql"
"encoding/json"
"log"
"math/rand"
"net/http"
"runtime"
// "strconv"
@chatman-media
chatman-media / package.json
Last active August 29, 2015 14:01
Stack answer
{
"name": "angular-curve",
"version": "0.0.0",
"description": "Description",
"homepage": "https://github.com/kenhkan/angular-curve",
"author": "Kenneth Kan <[email protected]>",
"licenses": {
"type": "MIT",
"url": "https://github.com/kenhkan/angular-curve/blob/master/LICENSE"
},
@chatman-media
chatman-media / ll.rb
Created May 23, 2014 10:20
stack answer
class Node
attr_accessor :value, :next_node
def initialize(val, next_in_line)
@value = val
@next_node = next_in_line
puts "Initialized a Node with value: #{value}"
end
end
@chatman-media
chatman-media / Gemfile
Last active August 29, 2015 14:01
Rack Jruby Torque bench
source 'https://rubygems.org'
gem 'torqbox'
# gem 'jdbc-postgres'
gem 'jdbc-mysql'
# gem 'activerecord'
# gem 'activerecord-jdbcpostgresql-adapter'
gem 'activerecord-jdbc-adapter'
# gem 'activerecord-jdbcmysql-adapter'
# gem 'sequel'
@chatman-media
chatman-media / Gemfile
Created May 10, 2014 19:31
Torqbox test app
source 'https://rubygems.org'
gem 'torqbox'
@chatman-media
chatman-media / guardfile.rb
Created April 9, 2014 01:41
guard rspec part
guard :rspec do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
source 'https://rubygems.org'
gem 'rails', '>= 4.1.0.rc2'
gem 'mongoid', github: 'mongoid/mongoid'
gem 'moped', github: 'mongoid/moped'
gem 'jbuilder', '~> 2.0'
gem 'multi_json'
# bundle exec rake doc:rails generates the API under doc/api.
@chatman-media
chatman-media / gist:9987755
Created April 5, 2014 05:11
Mongoid Error log
MOPED: 127.0.0.1:27017 QUERY database=rails_api_development collection=users selector={"_id"=>{"$oid"=>BSON::ObjectId('533c3958616c641142010000')}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 1.0680ms
Completed 500 Internal Server Error in 15ms
Moped::Errors::QueryFailure - The operation: #<Moped::Protocol::Query
@length=89
@request_id=2
@response_to=0
@op_code=2004
@flags=[]
@full_collection_name="rails_api_development.users"