Skip to content

Instantly share code, notes, and snippets.

View rogal111's full-sized avatar

Michał Rogowski rogal111

View GitHub Profile
@rogal111
rogal111 / seo.js
Created December 1, 2013 21:51
Custom parser for Codemirror for presell seo articles
Array.prototype.last = function() {
return this[this.length-1];
}
Array.prototype.random = function () {
return this[Math.floor(Math.random()*this.length)];
}
String.prototype.sample = function(start,end) {
res="";
@rogal111
rogal111 / paperclip_transliterate.rb
Created July 10, 2012 10:28
Transliterate Paperclip file name to use in URLs
# put this file in config/initializers
#
# USAGE:
# in your paperclip model:
# has_attached_file :document
# before_post_process { |c| transliterate_file_name(:document) }
module TransliteratePaperclip
def transliterate_file_name(paperclip_file)
@rogal111
rogal111 / mysql_phoneprefix_to_zone_field.sql
Created November 26, 2011 11:25
Populating the Zone field in function of telephone prefix
UPDATE telcountry_table
SET country =
CASE
WHEN left(telnum,4) = 0093 THEN 'Afghanistan'
WHEN left(telnum,5) = 00355 THEN 'Albania'
WHEN left(telnum,5) = 00213 THEN 'Algeria'
WHEN left(telnum,5) = 00376 THEN 'Andorra'
WHEN left(telnum,5) = 00244 THEN 'Angola'
WHEN left(telnum,6) = 001264 THEN 'Anguilla'
WHEN left(telnum,6) = 006721 THEN 'Antarctica'
@rogal111
rogal111 / devise.pl.yml
Created July 22, 2011 08:05
Devise v1.4.2 polish translation
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
# Devise v1.4.2 polish translation by @rogal111
pl:
errors:
messages:
expired: "stracił ważność, wyślij zapytanie o nowy"
not_found: "nie znaleziono"
already_confirmed: "już został aktywowany, możesz się zalogować"
not_locked: "nie był zablokowany"