Skip to content

Instantly share code, notes, and snippets.

View pramatias's full-sized avatar

kostas pramatias pramatias

View GitHub Profile
public class StringUtils {
public static boolean isBlank(String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if ((Character.isWhitespace(str.charAt(i)) == false)) {
return false;
}
(defmulti blank? class)
(defmethod blank? String [s] (every? #{\space} s))
(defmethod blank? nil [_] true)
#app/models/chatter.rb
class Chatter < ActiveRecord::Base
has_one :chats
end
#app/models/chat.rb
class Chat < ActiveRecord::Base
belongs_to :chatter, :foreign_key => 'chatter_id'
end
#app/models/chatter.rb
class Chatter < ActiveRecord::Base
has_one :chats
end
#app/models/chat.rb
class Chat < ActiveRecord::Base
belongs_to :chatter, :foreign_key => 'chatter_id'
end
#config/routes.rb
#**before
#/chatters
#/chatters/1
#/chats
#/chats/1
ActionController::Routing::Routes.draw do |map|
map.resources :chatters
map.resources :chats
#config/routes.rb
ActionController::Routing::Routes.draw do |map|
map.resources :chatters do |chatter|
chatter.resources :chats
end
#app/controllers/chats_controller.rb
#Parameters: {"chat"=>{"id"=>"1", "message"=>"cool"}}
class ChatsController < ApplicationController
hjgkhjgjjjk
jkhkhjklj
hghjjhhj
a = ""
func1 = Proc.new do
i = 0
while i <= 100
puts "func1 "
sleep(0.001)
a.concat "aaaa"
i = i + 1
end
a = ""
func1 = Proc.new do
i = 0
while i <= 100
puts "func1 "
sleep(0.001)
a.concat "aaaa"
i = i + 1
end
(def πρόσθεσε +)
(def αφαίρεσε -)
(def σύμβολο symbol)
(def σύμβολο? symbol?)
(def διάλεξε take)
(def διάλεξε-τελευταίο take-last)
(def διάλεξε-ν take-nth)
(def διάλεξε-μέχρι take-while)
;(def μακροεντολή defmacro)
(def τέσταρε test)