This file contains hidden or 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 | |
# sudo gem install sass | |
# npm install less -g | |
# npm install coffee -g | |
p 'Dux sass/less/coffee compiler v0.1' | |
while true | |
sleep 1 if (@last_mtime ||=0) > 0 |
This file contains hidden or 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
window.resize_crop = (img) -> | |
org = new Image() | |
org.src = img.src | |
org.onload = -> | |
j_img = $(img) | |
src = @src | |
img_w = parseInt j_img.css "width" |
This file contains hidden or 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
:styles => lambda { |i| i.instance.file_content_type =~ /image/ ? { :original => "800x600>" } : {} } |
This file contains hidden or 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 ApplicationController < ActionController::Base | |
before_filter :cloud_token | |
protected | |
def cloud_token | |
ct = params[:cloud_token] || return | |
url = "http://cloud.trifoliumdoo.com/token/#{ct}" | |
begin |
This file contains hidden or 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 | |
# Hotel - broj ratinga - rating - datum - soba1 opis - soba1 cijena - soba2 opis soba 2 cijena | |
require 'rubygems' | |
require 'digest/md5' | |
require 'pp' | |
class Csv | |
attr_accessor :head, :data |
This file contains hidden or 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
# https://github.com/mikel/mail | |
require 'rubygems' | |
require 'gmail' | |
require 'mail' | |
gmail = Gmail.new('[email protected]', 'pass') | |
inbox = gmail.mailbox('inbox') |
This file contains hidden or 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 sfor(list, &block) | |
for el in list | |
begin | |
yield(el) | |
rescue | |
concat(%[<div style="background-color:#fdd; padding:4px; border:1px solid #ccc;"><ul><li>Object: #{}#{el.as_link rescue '-'} (#{el.class.name})</li><li>Error: #{$!}</li></ul></div>]) | |
end | |
end | |
end |
This file contains hidden or 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
# plugin cheeckbox label state | |
window.checkboxLabel_do = (el, on_, off_) -> | |
if el.is(":checked") then el.next().html(on_).css({color:'#080'}) else el.next().html(off_).css({color:'#800'}) | |
$.fn.checkboxLabel = (on_, off_) -> | |
on_ ||= "ON" | |
off_ ||= "OFF" | |
@each -> | |
el = $(this) |
This file contains hidden or 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
# install openssl | |
sudo apt-get install openssl | |
# cd to certs folder, create if necessary :) | |
cd /etc/ssl/certs | |
# gen key | |
openssl genrsa -out websitename.key 2048 | |
# gen csr and upload file content to SSL issuer |
This file contains hidden or 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
SET GLOBAL time_zone = '+2:00'; # global | |
SET time_zone ='+2:00' # session | |
SELECT @@global.time_zone, @@session.time_zone; |