Skip to content

Instantly share code, notes, and snippets.

View macbury's full-sized avatar
🍻
🍺.drink! while 🍺.present?

macbury

🍻
🍺.drink! while 🍺.present?
View GitHub Profile
Identyfikator aplikacji
112766142088122
Klucz API
145169935bc6fd678eeb912f8608e364
App Secret
339f2c0e5f158b8f952a17625cb9fc51
Strona Płócienna
http://apps.facebook.com/maluch_driver/
Adres ramki
http://maluch-driver.heroku.com/
@macbury
macbury / mongoid_i18n.rb
Created June 13, 2011 22:03
mongoid i18n
module Mongoid::I18n
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def localized_field(name, options={})
field_name = name.to_s
set_field(field_name, :type => Hash)
my_block = {
'Quote' => [
/\[quote(:.*)?=(.*?)\](.*?)\[\/quote\1?\]/mi,
'<div class="quote"><p>\2</p><block>\3</block></div>',
'Quote with citation',
'[quote=mike]please quote me[/quote]',
:quote
],
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* main.cc
* Copyright (C) Arkadiusz Buras 2012 <macbury@hwdp>
*
sortowanie is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@macbury
macbury / ruby.rb
Created April 11, 2012 14:38
Akcja
render text: '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:typens="urn:AllegroWebApi" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><typens:doNewAuctionExtResponse><item-id xsi:type="xsd:long">2249118254</item-id><item-info xsi:type="xsd:string">-</item-info><item-is-allegro-standard xsi:type="xsd:int">0</item-is-allegro-standard></typens:doNewAuctionExtResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>'
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="urn:AllegroWebApi" xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ins0="urn:AllegroWebApi"><env:Body><doCheckNewAuctionExt><session-handle>10409c7ce48e8d5cd5bd043e62d4573f87fbc5b90bcc68bb00_1</session-handle><fields><item><fid>3</fid><fvalue-string></fvalue-string><fvalue-int>0</fvalue-int><fvalue-float>0.0</fvalue-float><fvalue-image>0</fvalue-image><fvalue-datetime>0</fvalue-datetime><fvalue-boolean>false</fvalue-boolean><fvalue-range-int><fvalue-range-int-min>0</fvalue-range-int-min><fvalue-range-int-max>0</fvalue-range-int-max></fvalue-range-int><fvalue-range-float><fvalue-range-float-min>0.0</fvalue-range-float-min><fvalue-range-float-maz>0.0</fvalue-range-float-maz></fvalue-range-float><fvalue-range-date><fvalue-range-date-min></fvalue-range-date-min><fvalue-range-date-max></fvalue-range-date-max></fvalue-range-date><fvalue-activesu
require "lib/last_album"
require "open-uri"
class LastFmScrapper
def initialize(band)
@last = LastAlbum.new
@bands_path = File.join([Rails.root, "public", "data", "zespoly"])
@albums_path = File.join([Rails.root, "public", "data", "okladki"])
Dir.mkdir(@bands_path) rescue nil
Dir.mkdir(@albums_path) rescue nil
authorization do
role :super_admin do
includes :main_redactor, :categories_manager, :access_admin, :page_manager, :ads_manager, :concerts_promotor, :band_promotor
end
role :guest do ||
has_permission_on :admin_tags, :to => [:suggest]
has_permission_on :admin_lyrics, :to => [:suggest]
has_permission_on :admin_bands, :to => [:suggest]
end
# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = RhCore::Config["base_site"]
SitemapGenerator::Sitemap.add_links do |sitemap|
sitemap.add root_path, :priority => 1.0, :changefreq => 'daily'
News.is_published.order("published_at DESC").all.each do |news|
sitemap.add news_path(:id => news.permalink), :lastmod => news.updated_at
end
@macbury
macbury / gist:3923003
Created October 20, 2012 11:15
Rails Template 0.1
# create rvmrc file
create_file ".rvmrc", "rvm use ruby-1.9.3-head@#{app_name} --create"
gem 'mysql2', group: :orm
gem "carrierwave", group: :orm
gem "devise", group: :authorization
gem "cancan", group: :authorization
gem "yettings", group: :other