Skip to content

Instantly share code, notes, and snippets.

View ali-sheiba's full-sized avatar

Ali Al-Sheiba ali-sheiba

View GitHub Profile
@ali-sheiba
ali-sheiba / _form.html.erb
Last active August 12, 2023 15:22
Rails scaffold with Bootstrap 4
<div class="page-header">
<div class="row">
<div class="col">
<%%= link_to "All <%= plural_table_name.capitalize %>", <%= index_helper %>_path, class: 'btn btn-default' %>
</div>
<div class="col text-right">
<%%= link_to "Edit", edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: 'btn btn-primary' %>
</div>
</div>
<h1>Show <%= singular_table_name %></h1>
@ftes
ftes / _seating_plan.html.haml
Created November 20, 2019 21:26
Drag and drop in CSS grid with rails 6, stimulus and rails-ujs
-# https://johnbeatty.co/2018/03/09/stimulus-js-tutorial-how-do-i-drag-and-drop-items-in-a-list/
.grid--draggable{ 'data-controller': 'seating-plan',
'data-seating-plan-endpoint': endpoint,
'data-action': 'dragstart->seating-plan#onDragStart dragover->seating-plan#onDragOver dragenter->seating-plan#onDragEnter drop->seating-plan#onDrop dragend->seating-plan#onDragEnd' }
- seating_plan.each do |seat|
- if seat[:is_empty]
.grid__item.grid__item--empty{ 'data-row': seat[:row],
'data-col': seat[:col],
style: "grid-row: #{seat[:row]}; grid-column: #{seat[:col]};",
class: ('grid__item--border' if seat[:is_border]) }
@ziaulrehman40
ziaulrehman40 / CircleCI 2.0 Parallel builds SimpleCov coverage report merging locally overview.md
Last active August 30, 2020 15:10
CircleCI 2.0 Parallel builds SimpleCov coverage report merging locally

Simplecov aggregated coverage report from CircleCI 2.0 parallel builds (focused on storing locally/within CI containers as artifacts)

Problem Statement

We have Rails application which is running tests on circleCI 2.0, we have simplecov configured to track the coverage of our test suite. Now the problem is with parallelism enabled, we have partial coverage reports in all different containers according to the tests those containers ran.

We obviously want to have consolidated simplecov coverage report which actually shows us overall coverage report.

@kulkarnisourabh
kulkarnisourabh / artillery_test.yml
Created December 4, 2017 10:46
Load test rails ActionCable websockets
config:
target: wss://test.cable.com/api/cable?token=f4adff3d1cb8fa6da3d678ba1eae330ac606
phases:
- {duration: 50, arrivalRate: 2, rampTo: 20, name: "Warming up"}
- {duration: 50, arrivalRate: 5, name: "max load 5 for 50"}
- pause: 100
- {duration: 100, arrivalRate: 1, name: "max load 1 for 100"}
- pause: 100
ws:
- {rejectUnauthorized: false}
@yalab
yalab / bootstrap-memo.md
Last active July 20, 2022 20:29
rails5 + webpacker + bootstrap
$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add bootstrap@4.0.0-beta jquery popper.js
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644
@wbotelhos
wbotelhos / clear-sidekiq-jobs.sh
Last active June 13, 2024 22:47
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
@erikras
erikras / SearchBox.js
Last active September 23, 2020 03:03
A search box that replaces a query parameter in the url
import React, { Component, PropTypes } from 'react'
import { withRouter } from 'react-router'
import queryString from 'query-string'
@withRouter
export default class SearchBox extends Component {
static propTypes = {
router: PropTypes.object.isRequired
}
@rodleviton
rodleviton / imagemagick-install-steps
Created May 26, 2014 07:37
Installing Image Magick on Ubuntu 14.04
sudo -i
cd
apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y
wget http://www.imagemagick.org/download/ImageMagick-6.8.7-7.tar.gz
tar xzvf ImageMagick-6.8.9-1.tar.gz
cd ImageMagick-6.8.9-1/
./configure --prefix=/opt/imagemagick-6.8 && make
checkinstall
@matthewlehner
matthewlehner / autopgsqlbackup
Created July 11, 2012 16:10
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
@doitian
doitian / solr_cap.rb
Created February 11, 2012 02:17
sunspot solr in capistrano
namespace :deploy do
task :setup_solr_data_dir do
run "mkdir -p #{shared_path}/solr/data"
end
end
namespace :solr do
desc "start solr"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec sunspot-solr start --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids"