Skip to content

Instantly share code, notes, and snippets.

View bosskovic's full-sized avatar

Marko Bošković bosskovic

  • Jomb AG
  • Novi Sad, Serbia
View GitHub Profile
@bosskovic
bosskovic / aws_s3_reupload.rake
Last active December 28, 2015 10:19
An example of a rake task for re-uploading the aws files.
namespace :s3_files do
desc 'Reuploads the s3 files from the old locations'
task :reupload => :environment do
ok = 0
not_ok = 0
puts ' ', '-----', 'Re-uploading User avatars'
User.where('avatar IS NOT NULL').each do |user|
new_path = "uploads/user/#{user.uuid.to_s}/avatar"
@bosskovic
bosskovic / avatar_uploader.rb
Last active December 28, 2015 10:18
Example of using carrierwave to manage file uploads
require 'carrierwave/processing/mime_types'
class AvatarUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
include CarrierWave::Processing::MiniMagick
include CarrierWave::MimeTypes
# Changes the file content_type using the mime-types gem
process :set_content_type
$(document).ready(function() {
var $container = $('#translators')
$($container).isotope({
itemSelector: '.item',
masonry: {
columnWidth: 280
}
})
@bosskovic
bosskovic / en.yaml
Created August 19, 2013 07:54
Example yaml file for r18n demonstration
greetings:
hello:
world: Hello World!
friend: Hello Friend!
user: Hello %1, welcome to %2
inbox:
messages: !!pl
0: Your inbox is empty.
1: You have one message in your inbox.
module Base
def listen
puts "think: interesting stuff ..."
end
end
class Attendee
include Base
end
@bosskovic
bosskovic / en.yml
Last active December 21, 2015 01:58
Example yaml file for the I18n demonstration
---
en:
greetings:
hello:
world: Hello World!
friend: Hello Friend!
user: Hello %{user}
inbox:
messages:
one: You have one message in your inbox.
@bosskovic
bosskovic / fuelPHP_example.php
Last active December 20, 2015 10:31
An example of language file loading and use in the FuelPHP framework. Source: http://fuelphp.com/dev-docs/classes/lang.html
<?php
// source: http://fuelphp.com/dev-docs/classes/lang.html
// Example of a language file:
return array(
'hello' => 'Hello :name',
'something'=> 'something :name!',
'test'=> array('hello' => 'Hello', 'something' => 'Plop') // Group
);
<?php
//source: http://web-technos.blogspot.com/2013/04/internationalization-with-fuelphp.html
return array(
'language' => 'en', // Default language
'language_fallback' => 'en', // Fallback language when file isn't available for default language
'locale' => 'en_US', // PHP set_locale() setting, null to not set
'locales' => array(
'en' => 'en_US',
'fr' => 'fr_FR'
@bosskovic
bosskovic / days.php
Created July 30, 2013 15:13
An example of PHP string array file used for internationalization
<?php
return array(
'monday' => 'Montag',
'tuesday' => 'Dienstag',
'wednesday' => 'Mittwoch',
'thursday' => 'Donnerstag',
'friday' => 'Frietag',
'saturday' => 'Samstag',
'sunday' => 'Sontag'
@bosskovic
bosskovic / I18n_test.php
Last active March 14, 2023 02:13
Example of PHP file translated using gettext
<?php
session_start();
if (isset($_GET["locale"])) {
$locale = $_GET["locale"];
}
else if (isset($_SESSION["locale"])) {
$locale = $_SESSION["locale"];
}
else {