Skip to content

Instantly share code, notes, and snippets.

View sharnik's full-sized avatar
📱
Developing mobile apps

Wojciech Ogrodowczyk sharnik

📱
Developing mobile apps
View GitHub Profile
require 'spec_helper'
describe Users do
describe 'Update user' do
let(:user) { FactoryGirl.create(:user) }
let(:image) {
Rack::Test::UploadedFile.new('spec/fixtures/images/treme.jpg', 'image/jpeg')
}
site :opscode
cookbook 'apt'
cookbook 'database'
cookbook 'set_locale', path: './cookbooks/set_locale'
cookbook 'postgresql_server_utf8', path: './cookbooks/postgresql_server_utf8'
site :opscode
cookbook 'apt'
cookbook 'locale'
cookbook 'mysql'
@sharnik
sharnik / long-strings-issue
Created September 27, 2013 12:07
It's just a gist to show an issue with highlighting and long file loading in vim-elixir.
defmodule Rosalind do
defp codon_table do
[
UUU: 'F', UUU: 'L', AUU: 'I', GUU: 'V',
UUC: 'F', CUC: 'L', AUC: 'I', GUC: 'V',
UUA: 'L', CUA: 'L', AUA: 'I', GUA: 'V',
UUG: 'L', CUG: 'L', AUG: 'M', GUG: 'V',
UCU: 'S', CCU: 'P', ACU: 'T', GCU: 'A',
UCC: 'S', CCC: 'P', ACC: 'T', GCC: 'A',
module MyFancyTool
module TestSupport
module ArubaExt
def with_redirected_stdout(&block)
redirect_stdout
yield
bring_back_stdout
end
class JsonProtect
def initialize(app)
@app = app
end
def call(env)
dup._call(env)
end
def _call(env)
/* Parse JSON hijacking protected strings: while(1);{ "foo": 1 } */
(function() {
var SECURITY_REG_EXP = /^while\(1\);([\s\S]*)\s*$/,
ORIGINAL_PARSEJSON = $.parseJSON;
$.extend($, {
stripSecurity: function(string) {
return string.replace(SECURITY_REG_EXP, "$1");
},
branches = `git branch`.chomp.split("\n")
branches.map!(&:strip)
branches.each do |branch|
puts "================================"
puts "Considering: #{branch}"
puts
system "git log --color --stat -n 1 #{branch}"
# config/routes.rb
namespace :foo do
match '/' => 'main#index'
resources :bar
resources :baz
end
config.middleware.use Rack::Bug,
:secret_key => "moje_tajne_haslo",
:panel_classes => [
Rack::Bug::TimerPanel,
Rack::Bug::ActiveRecordPanel,
Rack::Bug::CachePanel,
Rack::Bug::SQLPanel,
Rack::Bug::TemplatesPanel,
Rack::Bug::LogPanel,
Rack::Bug::MemoryPanel