Skip to content

Instantly share code, notes, and snippets.

View ismailmechbal's full-sized avatar

Ismail Mechbal ismailmechbal

View GitHub Profile
@ismailmechbal
ismailmechbal / README.md
Created March 7, 2016 07:07 — forked from derwiki/README.md
Ruby module that you can use in a `before_action` on sensitive controllers for which you'd like a usage audit trail

Adding an audit log to your Rails app

If you have any sort of administrative interface on your web site, you can easily imagine an intruder gaining access and mucking about. How do you know the extent of the damage? Adding an audit log to your app is one quick solution. An audit log should record a few things:

  • controller entry points with parameter values
  • permanent information about the user, like user_id
  • transient information about the user, like IP and user_agent

Using the Rails framework, this is as simple as adding a before_action to your admin controllers. Here’s a basic version that I’m using in production.

@ismailmechbal
ismailmechbal / 0. nginx_setup.sh
Created February 22, 2016 11:58 — forked from mikhailov/0. nginx_setup.sh
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@ismailmechbal
ismailmechbal / dashboard
Created February 9, 2016 09:54 — forked from gregology/dashboard
Service script for dashing. Update DASHING_DIR variable, add this file to /etc/init.d/ , chmod to 755, and let update rc.d with $ sudo update-rc.d dashboard defaults This scripts stops the dashing service with "killall thin" which will kill all thin services running on your server.
#!/bin/bash
# Dashing service
# Add this file to /etc/init.d/
# $ sudo cp dashboard /etc/init.d/
# Update variables DASHING_DIR, GEM_HOME, & PATH to suit your installation
# $ sudo nano /etc/init.d/dashboard
# Make executable
# $ sudo chmod 755 /etc/init.d/dashboard
# Update rc.d
# $ sudo update-rc.d dashboard defaults
@ismailmechbal
ismailmechbal / LICENSE
Created January 17, 2016 21:46 — forked from pallan/LICENSE
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@ismailmechbal
ismailmechbal / README.md
Created January 17, 2016 21:38 — forked from willjohnson/README.md
Server Status Widget for Dashing

Description

A Dashing widget that checks whether a server is responding to either an http or ping request. It displays either a check or alert depending on the response.

Usage

require 'mandrill'
require 'json'
mandrill = Mandrill::API.new 'YOUR_API_KEY'
yesterday_number = 0
todays_number = 0
clock = Time.new
day = clock.day
@ismailmechbal
ismailmechbal / gitlab_repo.rb
Created January 17, 2016 20:52 — forked from Fiyorden/gitlab_repo.rb
Gitlab repo for dashing
#!/usr/bin/env ruby
require 'net/http'
require 'json'
gitlab_token = "YOUR TOKEN"
gitlab_uri = "URL GITLAB"
# number of repositories to display in the list
# order the list by the numbers
ordered = true

Description

Simple Dashing widget that show the amount of open issues and bugs for a Gitlab project.

The widget was made by @joren for use @openminds. If you end up using this widget, please send me a tweet! I'd love to hear about it.

Dependencies

This widget requires the curb gem for easy curl request in Ruby and your Gitlab API key.

@ismailmechbal
ismailmechbal / README.md
Created January 17, 2016 20:38 — forked from miawgogo/README.md
Countdown. REVISED EDITION!!!!

Countdown. REVISED EDITION!!!!

This is a fork of ruleb's count down that rended one of the else ifs unreachable in his code. Even though he was notified by menny people he never fixed his code so i took it on to... fix 1 line of code. This Fork may expand if i have the time to re-learn coffie and see if any outher code is broken.

The rest of this readme and the html code and scss is still the orginal by ruleb.

Description

Simple Dashing widget to countdown until a certain moment. Flashes the widget when finished.

@ismailmechbal
ismailmechbal / contact_batch_email.html.erb
Created January 13, 2016 10:33 — forked from Joseworks/contact_batch_email.html.erb
Send batch emails on ActiveAdmin Rails 4.2.0
<!-- Contact batch email -->
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<div>Name: <%= @name %></div>
<br>
<div>Subject: <%= @subject %></div>