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
#include <iostream> | |
using namespace std; | |
#include "stog_pokazivaci.h" | |
//#include "stog_polje.h" | |
int kraj_rek; | |
bool print; | |
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
module ActiveModel | |
module Validations | |
def self.included(base) | |
base.class_eval do | |
@validation_stack = { | |
:any => [], | |
:create => [], | |
:update => [] | |
}.freeze | |
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 'digest/sha1' | |
class Attachment < ActiveRecord::Base | |
DIRECTORY = 'attachments' | |
PATH = File.join(Rails.root, 'public', DIRECTORY) | |
CHARACTERS = %w(a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9) | |
validates_presence_of :upload | |
before_create :set_attributes_from_upload |
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
class Array | |
def rand | |
self[Kernel.rand(length)] | |
end | |
end | |
characters = %w(a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9) | |
Array.new(4).inject("") {|string, ary| string << characters.rand } |
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
def table_listing(collection, &block) | |
row = RowHandler.new | |
capture(row, &block) | |
headers = "<tr>" + row.columns.map {|name, proc| "<th>#{name}</th>" }.join("\n") + "</tr>" | |
if collection.empty? | |
rows = "<tr><td colspan=\"#{row.columns.size}\">Ingen treff</td></tr>" | |
else | |
rows = collection.map do |item| | |
output = "<tr>" |
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
(function($){ | |
$.fn.dragscroll = function(target){ | |
// Initializing some locals | |
var positionWhenScrollStarted | |
var scrollWhenScrollStarted | |
var self = this | |
// The object that is scrolled when this/self is dragged | |
var targetDOMObject = $(target) | |
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
// GitHub Favorites | |
// version 0.1 (Whiny Whale) | |
// 2008-09-18 | |
// Copyright (c) 2008, August Lilleaas | |
// Released under the MIT license | |
// http://www.opensource.org/licenses/mit-license.php | |
// | |
// -------------------------------------------------------------------- | |
// | |
// This is a Greasemonkey user script. To install it, you need |
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
<html> | |
<head> | |
<%= javascript_include_tag *javascripts %> | |
</head> | |
<body> | |
<%= yield %> | |
</body> | |
</html> |
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 | |
# Runs Rails tests via command line. | |
# | |
# * rtest unit - runs all unit tests | |
# * rtest unit post - runs the unit test for the 'post' model | |
# * rtest unit post comment foo - runs those tests, yep | |
# * rtest functional - you guessed it! | |
# * rtest integration - blows up your computer | |
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
# Requires /usr/sbin/sendmail (e.g. postfix) | |
module Mailer | |
def self.deliver(to, subject, body) | |
IO.popen("/usr/sbin/sendmail #{to}", 'w+') do |sendmail| | |
sendmail.puts "Subject: #{subject}" | |
sendmail.puts "From: Your Name <[email protected]>" | |
sendmail.puts "To: #{to}" | |
sendmail.puts body | |
end | |
end |
OlderNewer