Skip to content

Instantly share code, notes, and snippets.

View dklisiaris's full-sized avatar

Dimitris Klisiaris dklisiaris

View GitHub Profile
@dklisiaris
dklisiaris / rails-boilerplate.md
Last active August 18, 2017 05:58
A manual setup for a typical rails 4.x. app with bootstrap layout, devise authentication, rspec testing framework with capybara and git version control.

Setup a new project and database.

Create a new rails app named app_name without Test::Unit and with mysql database:

rails new app_name -T -d mysql

or an app without Test::Unit and with postgresql database:

rails new app_name -T -d postgresql

or without Test::Unit and with the default sqlite:

{
"6":{"ddc":"370","text":"Εκπαίδευση. Παιδαγωγική","parent":"26"},
"2666":{"ddc":"370","text":"Εκπαίδευση2. Παιδαγωγική","parent":"48"},
"48":{"ddc":"300","text":"Κοινωνικές επιστήμες","parent":null},
"26":{"ddc":"370","text":"Εκπαίδευση3. Παιδαγωγική","parent":"2666"},
"2400":{"ddc":"800","text":"Λογοτεχνία","parent":null},
"2693":{"ddc":"860","text":"Ισπανική, ισπανόφωνη και πορτογαλική λογοτεχνία","parent":"2400"},
"2710":{"ddc":"863","text":"Ισπανική και ισπανόφωνη πεζογραφία","parent":"2693"},
"8527":{"ddc":"863","text":"Ισπανόφωνη πεζογραφία","parent":"2710"},
"1460":{"ddc":"863","text":"Ισπανόφωνη πεζογραφία (Περού)","parent":"8527"},
@dklisiaris
dklisiaris / start_elasticsearch.sh
Created January 5, 2015 16:32
Elasticsearch seems to start only with this command.
sudo start-stop-daemon --start -b --user elasticsearch -c elasticsearch --pidfile /var/run/elasticsearch.pid --exec /usr/share/elasticsearch/bin/elasticsearch -- -d -p /var/run/elasticsearch.pid --default.config=/etc/elasticsearch/elasticsearch.yml --default.path.home=/usr/share/elasticsearch --default.path.logs=/var/log/elasticsearch --default.path.data=/var/lib/elasticsearch --default.path.work=/tmp/elasticsearch --default.path.conf=/etc/elasticsearch
@dklisiaris
dklisiaris / remove_all_members_from_group.js
Created February 26, 2015 19:49
Facebook doesn't allow instant delete of a group. Instead all members must deleted first and finally the admin himself. This script runs on console and deletes all members.
var deleteAllGroupMembers = (function () {
var deleteAllGroupMembers = {};
// the facebook ids of the users that will not be removed.
// IMPORTANT: add your own facebook id here so that the script will not remove yourself!
var excludedFbIds = ['1234','11223344']; // make sure each id is a string!
var usersToDeleteQueue = [];
var scriptEnabled = false;
var processing = false;
deleteAllGroupMembers.start = function() {
@dklisiaris
dklisiaris / devise.el.yml
Last active August 29, 2015 14:16
Greek locale yml file for devise 3.4.1. Based on this https://gist.github.com/johndel/4390007 with some changes and additions.
el:
devise:
confirmations:
confirmed: "Ο λογαριασμός σας επιβεβαιώθηκε με επιτυχία. Είστε συνδεδεμένος/η."
send_instructions: "Σε λίγα λεπτά θα λάβετε οδηγίες για το πώς θα επιβεβαιώσετε το email σας."
send_paranoid_instructions: "Αν το email σας υπάρχει στη βάση δεδομένων μας, θα λάβετε email με οδηγίες για την επιβεβαίωση του λογαριασμού σας."
failure:
already_authenticated: "Είστε ήδη συνδεδεμένος."
inactive: "Ο λογαριασμός σας δεν έχει ενεργοποιηθεί ακόμα."
invalid: "Μη έγκυρο email ή κωδικός."
@dklisiaris
dklisiaris / install_nodejs_npm_ubuntu12-04.md
Last active December 27, 2018 11:46
Latest node.js & npm installation on Ubuntu 12.04

This is probably the quickest way to install nodejs and npm on 12.04. For compiling and install from source check this.

Use launchpad repo by Chris Lea

sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
### Install Oracle Java 8, this means you agree to their binary license!!
cd ~
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo aptitude -y install oracle-java8-installer
### Download and Install ElasticSearch
{
"image": "http://www.biblionet.gr/images/covers/b1062.jpg",
"title": "Προϊστορικά ζώα σε κουκκίδες",
"authors": [
"Μόνικα Ρούσσο"
],
"contributors": {
"μετάφραση": [
"Δήμος Αυγερινός"
]
@dklisiaris
dklisiaris / full_book_data.json
Last active August 29, 2015 14:17
Bookshark's extracted book with eager option enabled
{
"book": [
{
"title": "Σημεία και τέρατα της οικονομίας",
"subtitle": "Η κρυφή πλευρά των πάντων",
"image": "http://www.biblionet.gr/images/covers/b103788.jpg",
"author": [
{
"name": "Levitt, Steven D.",
"firstname": "Steven D.",
@dklisiaris
dklisiaris / only_persisted.md
Last active February 18, 2022 01:17
How do you reference only the persisted records in an active record association.

Setup

Generate models.

rails g model author name:string
rails g model book title:string author:references
bundle exec rake db:migrate