Skip to content

Instantly share code, notes, and snippets.

View halilim's full-sized avatar

Halil Özgür halilim

View GitHub Profile
@gaganawhad
gaganawhad / i18n conventions.md
Last active July 24, 2023 19:11
Moved to obsidian. Some conventions / guidelines / best practices that helped me while working on internationalization of a rails app.

Internationalization of a Rails App : conventions / guidelines / best practices

I have worked, and am currently working on internationalization of a Rails app. The apps require translating the ActiveRecord models. I have done some googling, but haven't really found any best practices / conventions / guidelines on how to think through this and what guidelines to follow.

I decided to create this document, to give myself a start and have it possibly help others. I am not an expert at any of this, and there may be things I am thinking incorrectly, but having it documented makes it easier to see the flaws and improve upon. If you have some ideas on additions, or think that somethings should change, get in touch.

Note: I use Globalize for model translations

  • I18n.locale controls the app wide locale. It refers to the particular localization version of the app. It defines how the app is localized to the user. It's scope is somewhat larger than the language/tran
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active April 1, 2025 08:06
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@mameier
mameier / deploy.rb
Created July 18, 2013 10:40
capistrano hack to procompile locally
desc "deploy precompiled assets"
task :sync_assets, :roles => :app do
run_locally 'mv public/no_assets public/assets || true'
run_locally 'if [ `find app/assets lib/assets vendor/assets -type f -newer public/assets | wc -l` -gt 0 ] ; then bundle exec rake assets:precompile ; fi'
servers = find_servers_for_task(current_task)
servers.each do |server|
run_locally "rsync -va --delete public/assets/ #{user}@#{server}:#{release_path}/public/assets/"
end
run_locally 'mv public/assets public/no_assets || true'
end
@stereoscott
stereoscott / active_admin.rb
Last active March 15, 2020 10:47
Stream CSV exports in ActiveAdmin in Rails 4
# if you want to monkey patch every controller, put this in initializers/active_admin.rb
ActiveAdmin::ResourceController.class_eval do
include ActiveAdmin::CSVStream
end
@asilbalaban
asilbalaban / ubuntu-php-dev-env.md
Last active August 26, 2022 23:35
Ubuntu 12.04 LTS 64bit sürümü ile PHP Geliştirme Ortamı Kurulum Rehberi Bu gist php geliştirme ortamı kurulum rehberidir.Temiz bir Ubuntu 12.04 LTS 64bit kurulumundan sonra işlemler bu işlemler yapılmış ve herhangi bir sorunla karşılaşılmamıştır.

Ubuntu 12.04 LTS 64bit sürümü ile PHP Geliştirme Ortamı Kurulum Rehberi

Bu gist php geliştirme ortamı kurulum rehberidir. Temiz bir Ubuntu 12.04 LTS 64bit kurulumundan sonra işlemler bu işlemler yapılmış ve herhangi bir sorunla karşılaşılmamıştır.

@jaymiejones86
jaymiejones86 / rails_website_launch_checklist.md
Last active January 18, 2021 17:51
Rails Website Launch Checklist

Ruby on Rails Website Launch Checklist

Copy this gist and customise it to your liking.

  • Run Brakeman and resolve any issues where required
  • Run rails best practices and resolve any warnings
  • Run full test suite and make sure all tests are passing
  • Make sure no dummy email addresses are left in any notification emails (eg contact form)
  • Make sure production assets compile correct (eg files in vendor, etc, compile and are not 404'ing in production environment)
  • If using unicorn in production, make sure deploys are restarting the unicorns
@dakshhmehta
dakshhmehta / laravel-jQuery-validation-rule.php
Last active October 24, 2024 17:08
Convert Laravel validation rules to jQuery validation rules to enable client-side validation. See more information about jQuery validation at http://jqueryvalidation.org/
<?php
use LaravelBook\Ardent\Ardent;
// You can extend Eloquent
// Example: http://laravel.io/bin/89V7
class JsModel extends Ardent {
/**
* Mapping in an array of Laravel Validator class rules
* and jQuery validator rules in format as
@cjonstrup
cjonstrup / Laravel\app\commands\ViewsCommand.php
Last active August 1, 2019 21:17
Clear Laravel 4.* app/storage/views artisan views:clear
<?php
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
class ViewsCommand extends Command {
/**
* The console command name.
*
* @var string
@stereoscott
stereoscott / active_admin_extensions.rb
Created January 12, 2014 00:29
Sample ActiveRecord model that uses paperclip to upload a csv report to s3
module ActiveAdmin
module Reports
module DSL
def enable_reports
action_item only: :index do
link_to("Download", {action: :report, params: params}, {method: :post, data: { confirm: "Are you sure you want to generate this report?"}})
end
collection_action :report, method: :post do
@msurguy
msurguy / List.md
Last active June 30, 2025 00:13
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):