Skip to content

Instantly share code, notes, and snippets.

Hrvoje Šimić shime

Block or report user

Report or block shime

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shime
shime / gist:1077934
Created Jul 12, 2011
Initialize compass in new rails app
View gist:1077934
compass init rails . --using blueprint
View render_links.js.erb
@shime
shime / instance_eval explanation.rb
Created Jan 14, 2012
instance_eval explanation
View instance_eval explanation.rb
val = "pizdarija"
val.randomize
val.instance_eval do
def randomize
split(//).to_a.shuffle.join
end
View proba.c
#include <stdio.h>
int main(){
srand(time(NULL));
int i = 0;
int random;
for (i=0;i < 10;i++){
random = rand()%1000;
printf("%d\n",random);
}
return 0;
@shime
shime / hello.rb
Created Jan 20, 2012
hello world in sinatra
View hello.rb
require 'sinatra'
get '/hi' do
"hello world!"
end
@shime
shime / example_controller.rb
Created Feb 16, 2012
sending errors to Exceptional with rescue_from
View example_controller.rb
class ExampleController < ApplicationController
rescue_from Exception, :with => :render_custom
def render_custom(exception)
if Exceptional::Remote.error(Exceptional::ExceptionData.new(exception, "Test Exception"))
Rails.logger.info "Exceptional: #{exception.class} has been reported to Exceptional"
else
Rails.logger.error "Exceptional: Problem sending exception. Check your API key."
end
View prvi_zadatak.rb
### Brojčano na ekranu ispišite koliko godina ima sekundi.
### Koliko imate godina ako ste stari 8286 dana?
View drugi_zadatak.rb
### Ispišite svoje ime i prezime unatrag
### Ispišite trece slovo svog imena velikim slovom
@shime
shime / javascript_notifier.html
Created Feb 23, 2012
HTML code for Airbrake javascript notifier
View javascript_notifier.html
<script type="text/javascript">
//<![CDATA[
(function(){
var notifierJsScheme = (("https:" == document.location.protocol) ? "https://" : "http://");
document.write(unescape("%3Cscript src='" + notifierJsScheme + "airbrake.io/javascripts/notifier.js' type='text/javascript'%3E%3C/script%3E"));
})();
//]]>
</script><script src="http://airbrake.io/javascripts/notifier.js" type="text/javascript"></script>
View treći_zadatak.rb
### Napišite program koji ce ispisivati string od 10 slova i 5 znamenki
### i to svaki put u drukcijem rasporedu
### Napišite program koji ce ispisati brojeve od 1 do 10, svaki u svom redu
You can’t perform that action at this time.