Skip to content

Instantly share code, notes, and snippets.

bonyiii

Block or report user

Report or block bonyiii

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bonyiii
bonyiii / start_rails_api.sh
Last active Jan 11, 2017
Start Rails Application
View start_rails_api.sh
docker run -it \
--name sapi \
-p 3000:3000 \
--security-opt seccomp:chrome.seccomp.json \
-e DISPLAY=unix$DISPLAY \
-v /home/boni/public_html/app/my-api/gems:/usr/local/bundle \
-v /home/boni/public_html/app/my-api:/var/www/my-api \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/Downloads:/home/dev/Downloads \
-v $HOME/.config/google-chrome/:/home/dev/data \
View rails_api.entrypoint.sh
#!/bin/bash
set -e
case "$1" in
rails|rake|passenger)
# ensure the right database adapter is active in the Gemfile.lock
if [ -z "$NO_BUNDLE" ]; then
# bundle install --without development test
bundle install
chown dev:dev $GEM_HOME -R
@bonyiii
bonyiii / rails_api.Dockerfile
Created Dec 19, 2016
Rails application dockerfile
View rails_api.Dockerfile
FROM myapp-base
RUN mkdir -p /var/www/myapp-api && chown dev /var/www/myapp-api
WORKDIR /var/www/myapp-api
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 3000
@bonyiii
bonyiii / base_imgage.Dockerfile
Created Dec 19, 2016
How to set up rails development with docker base image
View base_imgage.Dockerfile
# original idea taken from
# https://github.com/docker-library/redmine/blob/d564a3b0d78016b2f24af2d74bcdace26a1ac0a3/3.1/Dockerfile
FROM ruby:2.3
MAINTAINER Bonaventura Fleischmann <bonaventura.fleischmann@digitalnatives.hu>
# Add user whose name the app will be run within the container
# the user id should be the default first linux user id
RUN useradd -u 1000 dev
@bonyiii
bonyiii / mailer.rb
Created Jul 31, 2016
Redmine mailer with sending attachments
View mailer.rb
# Redmine - project management software
# Copyright (C) 2006-2016 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
View emacs_ctags
#!/bin/sh
#ctags --tag-relative -e --exclude=.git --exclude=node_modules --exclude=storage --exclude=tmp -Rf
ctags --tag-relative -e -Rf TAGS --exclude=.git --exclude=node_modules --exclude=storage --exclude=tmp . $(bundle list --paths)
# https://github.com/syl20bnr/spacemacs/issues/2275
sed -ri '/^.{1000}/d' TAGS
#https://github.com/mmorearty/elixir-ctags
View gist:2b1cf68b7894846a9678
http://stackoverflow.com/questions/941594/understanding-the-rails-authenticity-token
https://www.owasp.org/index.php/HttpOnly#Who_developed_HttpOnly.3F_When.3F
http://blog.codinghorror.com/protecting-your-cookies-httponly/
http://stackoverflow.com/questions/1177863/how-do-i-ignore-the-authenticity-token-for-specific-actions-in-rails
View vizsga
#define ENGINE_LEFT OUT_A
#define ENGINE_RIGHT OUT_C
#define ENGINE_BOTH OUT_AC
#define SENS_TOUCH IN_2
#define SENS_US_FRONT IN_3
#define SENS_US_LEFT IN_1
#define SENS_COLOR IN_4
int us_left_was, us_left_new;
View LEGO PATHFINDING
#define ENGINE_LEFT OUT_A
#define ENGINE_RIGHT OUT_C
#define ENGINE_BOTH OUT_AC
#define SENS_TOUCH IN_1
#define SENS_US IN_3
#define SENS_COLOR IN_4
bool button_pressed() {
int pressed1, pressed2;
View gist:f92586e6902ffa261386
#define ENGINE_LEFT OUT_A
#define ENGINE_RIGHT OUT_C
#define ENGINE_BOTH OUT_AC
#define SENS_TOUCH IN_4
#define SENS_US IN_2
#define SENS_COLOR IN_1
bool button_pressed() {
int pressed1, pressed2;
You can’t perform that action at this time.