Skip to content

Instantly share code, notes, and snippets.

View cbilgili's full-sized avatar

Canbey Bilgili cbilgili

  • Istanbul
View GitHub Profile
@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 / 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: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 / 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: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 / 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 / crud-saga.js
Created December 27, 2016 08:59
Redux CRUD Saga (redux-saga)
import { takeLatest } from 'redux-saga'
import { call, put } from 'redux-saga/effects'
import fetch from 'isomorphic-fetch'
import * as actions from './modules/grid'
import * as api from '../lib/api'
export function* fetchGrids(action) {
try {
const grids = yield call(api.GET, 'grids')
yield put(actions.fetchGridsSuccess(grids))
@cbilgili
cbilgili / iconExample.js
Created February 24, 2017 10:15 — forked from flunder/iconExample.js
An example gist trying to show how to implement an icon within a tcomb form in react-native
const Form = t.form.Form;
const postOptions = t.struct({
publication: t.String,
tags: t.String,
more: t.String,
facebook: t.Boolean
})
const options = {
{"total":200,"completed":3}
@cbilgili
cbilgili / gist:1d6b9b1538996c7813e869c7ffc97b4b
Created July 27, 2017 17:38
How to keep rails command from Rails Console running after SSH Client (PuTTy) closes
Use sudo apt-get install screen to install screen. Then run it using screen. Now you have a separate console window which can be detached using Ctrl + A, then D. Closing putty will not end your screen-session. If you log back in at any later point, you may resume the sessions using screen -r.
To summarize:
> sudo apt-get install screen
> screen
# pops up a new shell
> rails c
# run your reindex operation
# press Ctrl + A, then D