This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/otobrglez/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin10.8.0] | |
-- Control frame information ----------------------------------------------- | |
c:0066 p:---- s:0274 b:0274 l:000273 d:000273 CFUNC :connect | |
c:0065 p:0011 s:0271 b:0271 l:000800 d:000270 BLOCK /Users/otobrglez/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799 | |
c:0064 p:0031 s:0269 b:0269 l:000268 d:000268 METHOD /Users/otobrglez/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:54 | |
c:0063 p:0026 s:0257 b:0257 l:000256 d:000256 METHOD /Users/otobrglez/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:99 | |
c:0062 p:0485 s:0251 b:0251 l:000800 d:000800 METHOD /Users/otobrglez/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799 | |
c:0061 p:0011 s:0243 b:0243 l:000242 d:000242 METHOD /Users/otobrglez/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:755 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'set' | |
a = ["a","b","c","d"] | |
b = ["b","d"] | |
Benchmark.bm do |x| | |
x.report do | |
(a.inject(0) {|s,i| s += b.include?(i)?1:0 } == b.size) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'bundler/setup' | |
require "mongo" | |
include Mongo | |
@client = MongoClient.new('localhost') | |
@db = @client['equations_demos'] | |
@equations = @db['equations'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# For this example to run you have to enable ElasticSearch plugin "lang-javascript" and | |
# also set default scripting language in elasticsearch.yml to "script.default_lang: js" | |
# in this way you will change scripting engine from default mvel to Mozilla Rhino | |
require "bundler/setup" | |
require 'tire' | |
# Tire.configure { logger STDERR } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/source_maps.rb | |
if Rails.env.development? | |
module CoffeeScript | |
class SourceMapError < StandardError; end; | |
class << self | |
def compile script, options | |
script = script.read if script.respond_to?(:read) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /* vim: set ai ts=4 ft=sh: */ | |
# | |
# Copyright 2011, The Android Open Source Project | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Also! | |
# include ActionView::Helpers::TranslationHelper | |
def local_invite_text invite, options={} | |
invite_text = card.category.invite_text | |
key = invite_text.present? ? nil : :invite_via_sms | |
default = invite_text.present? ? invite_text : nil | |
time = if card.local_starts_at.present? | |
card.verbose_time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -w | |
class Card | |
attr_accessor :is_sync | |
def initialize options={} | |
@is_sync = options[:is_sync] | |
end | |
def is_sync? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env ruby | |
lokacija_a = {x: 10, y: 20} | |
lokacija_b = {x: 12, y: 22} | |
lokacija_c = {x: 13, y: 33} | |
# Novo polje z vsemi lokacijami | |
lokacije = [lokacija_a, lokacija_b, lokacija_c] | |
# Dodajanje lokacij |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
class CategoryImageUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick | |
include Sprockets::Helpers::RailsHelper | |
include Sprockets::Helpers::IsolatedHelper | |
def default_url | |
asset_path("fallback/" + [version_name, "category_image.png"].compact.join('_')) |