Skip to content

Instantly share code, notes, and snippets.

@faouzzz
faouzzz / index.html
Created May 19, 2016 09:09 — forked from anonymous/index.html
JS Bin time slots selection // source http://jsbin.com/lufufe
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="time slots selection">
<script src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<meta charset="utf-8">
@faouzzz
faouzzz / index.html
Created May 19, 2016 18:07 — forked from anonymous/index.html
JS Bin time slots selection // source https://jsbin.com/lufufe
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="time slots selection">
<script src="https://code.jquery.com/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<meta charset="utf-8">
@faouzzz
faouzzz / holiday-fr.js
Created May 23, 2016 06:05
jours fériés en France
// https://github.com/damienlabat/moment-ferie-fr
(function () {
"use strict";
var initialize = function (moment) {
// Source: http://techneilogy.blogspot.fr/2012/02/couple-of-years-ago-i-posted-source.html
moment.fn.easterDay = moment.fn.paques = function (Y) {
@faouzzz
faouzzz / holidays-fr.rb
Created May 23, 2016 07:35
helpers pour les jours fériés en France
def is_exceptional? date
holiday(date) != nil
end
def is_weekend? date
date.saturday? || date.sunday?
end
def is_working_day? date
not(is_exceptional?(date)) and not(is_weekend?(date))
@faouzzz
faouzzz / Gemfile
Created May 24, 2016 21:44
rails 4.2, sqlite3, devise, cancan, haml, semantic
source 'https://rubygems.org'
gem 'rails', '~> 4.2'
gem 'rails-i18n'
gem 'sqlite3', "~> 1.3"
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '~> 3.0'
gem 'coffee-rails', '~> 4.1'
gem 'jquery-rails', "~> 4.1"
gem 'turbolinks', "~> 2.5"
@faouzzz
faouzzz / simple_form.rb
Last active June 27, 2016 18:40
simple_form rails initialization file for semantic ui
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
# complete input. You can remove any component from the
# wrapper, change the order or even add your own to the
# stack. The options given below are used to wrap the
# whole input.
config.wrappers :default, class: :field,
hint_class: :field_with_hint, error_class: "field error" do |b|
## Extensions enabled by default
@faouzzz
faouzzz / bootstrap-datetimepicker-fr.js
Last active May 26, 2016 21:25
date time picker with locales fr
/* =========================================================
* bootstrap-datetimepicker.js
* =========================================================
* Copyright 2012 Stefan Petre
*
* Improvements by Andrew Rowls
* Improvements by Sébastien Malot
* Improvements by Yun Lai
* Improvements by Kenneth Henderick
* Improvements by CuGBabyBeaR
@faouzzz
faouzzz / Gemfile
Last active November 20, 2017 22:31
Rails Gemfile with test and guard
# Gemfile - https://git.io/vDW2B
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end
gem 'rails', '~> 5.1.4'
gem 'puma', '~> 3.0'
@faouzzz
faouzzz / rails_template.rb
Last active August 9, 2016 15:41
rails template
# >---------------------------------------------------------------------------<
#
# _____ _ _ __ ___ _
# | __ \ (_) | \ \ / (_) | |
# | |__) |__ _ _| |___\ \ /\ / / _ ______ _ _ __ __| |
# | _ // _` | | / __|\ \/ \/ / | |_ / _` | '__/ _` |
# | | \ \ (_| | | \__ \ \ /\ / | |/ / (_| | | | (_| |
# |_| \_\__,_|_|_|___/ \/ \/ |_/___\__,_|_| \__,_|
#
# This template was generated by RailsWizard, the amazing and awesome Rails
@faouzzz
faouzzz / my_db.rake
Created October 1, 2016 15:35 — forked from jay16/my_db.rake
rails backup DB
#encoding: utf-8
require "fileutils"
namespace :my_db do desc "Backup project database. Options: DIR=backups RAILS_ENV=production MAX=7"
desc "usage - bundle exec rake my_db:backup RAILS_ENV=production MAX=15 DIR=db/db.bak"
task :backup => [:environment] do
# config base dir
datestamp = Time.now.strftime("%Y%m%d%H%M")
base_path = Rails.root
backup_folder = File.join(base_path, ENV["DIR"] || "backups")
FileUtils.mkdir_p(backup_folder) unless File.exist?(backup_folder)