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
$ RUST_BACKTRACE=1 rustc set_1.rs
set_1.rs:7:33: 7:36 error: mismatched types:
expected `u16`,
found `_`
(expected u16,
found floating-point variable) [E0308]
set_1.rs:7 let mut final_score : u16 = 0.0;
^~~
error: internal compiler error: Impl DefId { krate: 2, node: 36957 } was matchable against Obligation(predicate=Binder(TraitPredicate(core::ops::Add<_>)),depth=1) but now is not
note: the compiler unexpectedly panicked. this is a bug.

Keybase proof

I hereby claim:

  • I am sharnik on github.
  • I am sharnik (https://keybase.io/sharnik) on keybase.
  • I have a public key whose fingerprint is 3784 19EB 4928 F052 EBBF B12D AC2E 2F76 6EE0 8CC3

To claim this, I am signing this object:

@sharnik
sharnik / fancy_sinatra_api.rb
Created March 28, 2014 15:16
rspec_api_documentation usage example
class FancyAPI < API
patch '/:id' do
object = FancyObject.find(params[:id])
object.update(params[:fancy_object]
object.to_json
end
end
site :opscode
cookbook 'apt'
cookbook 'chruby'
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
/* 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");
},