Skip to content

Instantly share code, notes, and snippets.

@faouzzz
faouzzz / Dockerfile
Last active February 19, 2017 01:40
Dockerfile for rails application
FROM ruby:alpine
MAINTAINER nfa
RUN apk --update --no-cache add \
build-base \
nodejs \
zlib-dev \
libxml2-dev \
libxslt-dev \
tzdata \
yaml-dev \
@faouzzz
faouzzz / docker-compose.yml
Last active February 19, 2017 01:41
docker-compose.yml for rails project
web:
build: .
ports:
- 3000:3000
links:
- db
volumes:
- .:/app
volumes_from:
- gems
@faouzzz
faouzzz / version-1.js
Created November 1, 2016 21:50 — forked from BaylorRae/version-1.js
Create fixed table headers with jQuery
// http://obvcode.blogspot.com/2007/11/easiest-way-to-check-ie-version-with.html
var Browser = {
version: function() {
var version = 999; // we assume a sane browser
if (navigator.appVersion.indexOf("MSIE") != -1) {
// bah, IE again, lets downgrade version number
version = parseFloat(navigator.appVersion.split("MSIE")[1]);
}
return version;
@faouzzz
faouzzz / _form.html.erb
Last active February 6, 2017 18:00 — forked from kouheiszk/_form.html.erb
simple_form.rb for semantic ui
<%= f.input :email,
wrapper: :semantic_icon_input,
label: false,
required: true,
placeholder: t('users.form.placeholder.email'),
left_icon: 'user' %>
@faouzzz
faouzzz / README.md
Created February 6, 2017 14:31 — forked from atenni/README.md
How to permalink to a gist's raw file

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]

@faouzzz
faouzzz / rails.sh
Last active February 7, 2017 11:05
rails app creator
rails new $1 -CBT && cd $1 && \
git init . && git add . && git commit -m "initial commit" && \
curl -Lk https://git.io/vDW2B > Gemfile && bundle && \
rails g simple_form:install && \
curl -Lk https://git.io/vDWDc > config/initializers/simple_form.rb && \
curl -Lk https://git.io/vDlT6 > config/locales/simple_form.fr.yml && \
erb2haml && rm -fr app/views/layouts/*.erb && \
git add --all && git commit -m "set basic config" && git checkout -b dev
# curl -Lk https://raw.githubusercontent.com/tigrish/devise-i18n/master/rails/locales/fr.yml
@faouzzz
faouzzz / table_to_csv.rb
Created June 12, 2017 15:13 — forked from sandys/table_to_csv.rb
convert a html table to CSV using ruby
# run using ```rvm jruby-1.6.7 do jruby "-J-Xmx2000m" "--1.9" tej.rb```
require 'rubygems'
require 'nokogiri'
require 'csv'
f = File.open("/tmp/preview.html")
doc = Nokogiri::HTML(f)
csv = CSV.open("/tmp/output.csv", 'w',{:col_sep => ",", :quote_char => '\'', :force_quotes => true})
@faouzzz
faouzzz / .env
Last active July 31, 2017 17:55
Dockerfile and docker-compose with .env for rails application
DB_USER=postgres
DB_PASS=postgres_password
DOCKER_IMAGE=my_app
SECRET_KEY_BASE=b1cb46476e90acf49363e03be5a9bea53053c37bd4dda5b1d8d81351fef49e894f5d913dd03ceb389ba279379a6244571f8fcb48b46024334e98ef658dd49de6
RAILS_ENV=production
RAILS_WEB_PORT=3000
BUNDLE_PATH=/gems
@faouzzz
faouzzz / datatable.net-se.css
Created August 1, 2017 19:26
datatable.net-se index files with buttons plugin
/*
*= require datatables.net-se/css/dataTables.semanticui
*= require datatables.net-buttons-se/css/buttons.semanticui
*/
@faouzzz
faouzzz / notification.js
Created August 2, 2017 14:20
semantic ui flash notification custumized transparency and close / auto hide
// semantic-ui flash notification hide / auto hide
function hideFlash() {
return $('#flash').transition('slide', 800);
}
$(document).on('turbolinks:load', function(){
setTimeout(hideFlash, 5000);
$('#flash .message .close').on('click', hideFlash);
});