Skip to content

Instantly share code, notes, and snippets.

View masak2009's full-sized avatar

Martin Rychlovsky masak2009

View GitHub Profile
@masak2009
masak2009 / [outputs]
Created November 24, 2022 14:20 — forked from chrismo/[outputs]
Dump date/time formats with examples of a locale in Rails
$ bin/rake i18n:show_sample_dates_and_times['en-MY']
time:
date : %m/%d/%Y : 2012-10-15
date_day : %d : 15
date_hour : %l:%M %p : 4:13 pm
date_month : %B : October
date_month_name : %B %e, %Y : 15 October 2012
date_month_year : %B %Y : October 2012
date_short_month_year : %e %b %Y : 15 Oct 2012
date_short_year : %m/%d/%y : 15-10-12

Emoji Encoder

Introdution

Gem which enable encoding and decoding strings with 4 bytes chars like Emoji to save into 2 bytes databases (For example: Default setup of Mysql DB).

Note

Usage was tested with Ruby on Rails 5.2. It should work with Rails 4 or Rails 6 too.

========= XML on Rails ============
sudo gem install builder
The Builder::XmlMarkup class provides methods:
cdata!(text) | Adds a CDATA section.
comment!(comment_text) | Adds a comment.
declare!(inst, *args, &block) | Adds a declaration. args specifies 0 or more arguments.
instruct!(directive_tag=:xml, attrs={}) | Adds a processing instruction. Attributes are specified with an array of hash entries.
new(options={}) | Creates an XML markup Builder object. The following options may be specified in an array of hash entries. :target=>targetObject:indent=>indentation :margin=>initial_indentation
======= RSpec ve zkratce =========
Configure the gems
# in config/environments/test.rb
config.gem "rspec", :lib => false, :version => ">= 1.2.0"
config.gem "rspec-rails", :lib => false, :version => ">= 1.2.0"
Pro scaffoldovani se pouziva prikaz rspec_scaffold namisto scaffold
DULEZITE: pouzivat jednotne cislo
======= Priprava Spree pro CR =======
nastavit v app/models/app_configuration.rb toto:
preference :address_requires_state, :boolean, :default => false # should state/state_name be required
preference :default_country_id, :integer, :default => 52 #Czech Republic
Ujistit se, ze se to nepretezuje nejakou extension!
Zkontrolovat v admin casti Spree, ze shipping methods (admin/shipping_methods) je nastaveno EU_VAT a ne North America!
In order to change the port on Mac OS-X for your SSH daemon, follow the following steps:
====== HOW TO CHANGE SSH PORT on OSX Snow Leopard ===========
Open Terminal and as edit the file /etc/services (as root)
Add a line at the bottom:
secret-ssh 43539/tcp # secret SSH port
Edit file /System/Library/LaunchDaemons/ssh.plist and replace the code:
<key>SockServiceName </key>
-------- CURL - zkurvena to vec :-D -----------
For properly working parsing commands from promt in OSX, just install curl as follow:
sudo port install curl +ssl +http
===== HOW TO PREPARE TRANSLATE PRODUCT FOR CZ & EN-GB =====
rake db:migrate
If you have pre-existing data, you'll need to run this rake task:
rake spree:extensions:product_translations:globalize_legacy_all_data
Then translate EN created data to english
==== id3lib & id3lib-ruby on Mac OSX Snow Leopard ====
Just install from ports id3lib:
$ sudo port install id3lib
After that just do massive google search or try this (work for me):
Installed id3lib is in /opt/local, then:
Mac OS X
I když si na Mac OS X můžete též hezky zakompilovat, existuje tu snazší způsob, jak si na něm pohrát s CouchDB – pomocí CouchDBX. Sice se jedná o neoficiální aplikaci, ale instalace je velice pohodlná – stáhněte, dvojklikněte a máte běžící CouchDB.
Další možností je využít MacPorts:
$ sudo port selfupdate
$ sudo port install couchdb
$ sudo launchctl load -w /opt/local/Library/LaunchDaemons/org.apache.couchdb.plist
Poslední příkaz spustí CouchDB a přidá ji do seznamu démonů spouštěných po startu.