Skip to content

Instantly share code, notes, and snippets.

View cbilgili's full-sized avatar

Canbey Bilgili cbilgili

  • Istanbul
View GitHub Profile
@cbilgili
cbilgili / README.md
Created June 2, 2016 11:56 — forked from jhilden/README.md
Setup for using i18n-js together with react-rails i18n-js for server side prerendering

When using react-rails for an internationalized app it makes a lot of sense to use i18n-js for translations, so that you can reuse the the strings from your rails app's .yml files (and all the tooling & services that exist around that).

When you use the prerender feature of react-rails you face 2 problems:

  • The first is that translation.js & i18n.js from i18n-js need to be loaded inside the server-side JS prerendering processes, which is achieved by loading them inside the components.js.
  • The second problem is the server processes need to be aware of the current locale of each HTTP request. This is done by adding a custom renderer and using the before_render hook to configure i18n-js accordingly for each render call.
@cbilgili
cbilgili / gist:13f4100f5d15ee80f203
Created January 30, 2016 13:41
Flickr search + google place search reactjs api
//if (this.props.google_place_id !== undefined && this.props.google_place_id != '') {
// var request = {
// placeId: this.props.google_place_id,
// language: 'tr'
// };
// service = new google.maps.places.PlacesService(document.createElement('div'));
// service.getDetails(request, (function (place, status) {
// if (status == google.maps.places.PlacesServiceStatus.OK) {
// // console.log(place.photos[0].getUrl({'maxWidth': 300, 'maxHeight': 300}));
// console.log(place);
@cbilgili
cbilgili / ReactTrixEditorComponent.jsx
Created January 23, 2016 20:16
React Trix Editor
class TrixEditor extends React.Component {
propTypes: {
value: PropTypes.string,
onChange: PropTypes.func
}
componentDidMount () {
this.trix = ReactDOM.findDOMNode(this)
this.changeListener = document.addEventListener(
@cbilgili
cbilgili / gist:0dc4ea08abf8a408b4c5
Created July 6, 2015 08:07
SSH ile bağlantı kurulurken hangi parametrelerin dikkate alındığını gösterir
SSH ile bağlantı kurulurken hangi parametrelerin dikkate alındığını gösterir
ssh -v web.greencomfort.be
@cbilgili
cbilgili / gist:d07a9f58809a0263747c
Created May 29, 2015 14:23
Mac os Mavericks change clear
Type this command:
dscacheutil -flushcache
To reload DNS type this command:
sudo killall -HUP mDNSResponder
@cbilgili
cbilgili / gist:1a500d1bfb227699b10f
Created March 26, 2015 13:25
PG::Error: ERROR: new encoding (UTF8) is incompatible
======= Prolbem =================================================================================================================
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute:
rake db:create , command I get:
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'.......
bin/rake:16:in `load'
@cbilgili
cbilgili / foreman.cap
Created March 19, 2015 15:00
Foreman unicorn upstart rbenv
set :unicorn_port, 5087
namespace :foreman do
desc "Export the Procfile to Ubuntu's upstart scripts"
task :export do
on roles(:app) do
within current_path do
execute :rbenv, :sudo, "foreman export upstart /etc/init --procfile=./Procfile -a #{fetch(:application)} -p #{fetch(:unicorn_port)} -u #{fetch(:user)} -l #{shared_path}/log"
end
@cbilgili
cbilgili / gist:6efdf06635fe17e5df5e
Last active August 29, 2015 14:13
iterm2 sağ sol silme sekme tab gitme
I'm in Lion
with iTerm2, Zsh and Oh-My-Zsh
but I cannot move through words when pressing: ALT+left arrow or CMD+left arrow or something
instead, when I press "ALT+right arrow" it prints [C and when I press "SHIFT+ALT+left arrow" it prints D0
how I can config iTerm2 to behave like any other program when moving through words?
*********
@cbilgili
cbilgili / Public key to remote
Created July 12, 2014 09:37
Local SSH public keyi sunucuya eklemek. Sunucuya şifresiz bağlanabiliriz.
Local SSH public keyi sunucuya eklemek. Sunucuya şifresiz bağlanabiliriz.
cat ~/.ssh/id_rsa.pub | ssh deployer@178.xxx.xxx.xxx 'cat >> ~/.ssh/authorized_keys'
@cbilgili
cbilgili / gist:9392200
Created March 6, 2014 15:30
Git Initializing
Git Config
Check your Git configuration parameters:
$ git config -l --global
user.name=Daniel Kehoe
user.email=daniel@danielkehoe.com
The email address will identify you to any services that use your Git repo, such as GitHub and Heroku.
Life will be easier if you use the same email address for all services where you use Git (so sign up for GitHub and Heroku using the same address).