Skip to content

Instantly share code, notes, and snippets.

Houssem Fathallah houssemFat

Block or report user

Report or block houssemFat

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
View messenger_bot.rb
unless Rails.env.production?
bot_files = Dir[Rails.root.join('app', 'messenger_bot', '**', '*.rb')]
bot_reloader = do
bot_files.each{ |file| require_dependency file }
ActionDispatch::Callbacks.to_prepare do
MarZab / leaflet-custom-map.html
Last active Oct 5, 2017
Leaflet with latlng scale in meters and Control.Scale to match
View leaflet-custom-map.html
<!DOCTYPE html>
<title>Leaflet Custom Simple Map Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="" />
<link rel="stylesheet" href="">
MattWilcox /
Last active Jan 14, 2020
Fetch, build, and install the latest nginx with the latest OpenSSL for RaspberryPi
#!/usr/bin/env bash
# names of latest versions of each package
export VERSION_PCRE=pcre-8.38
export VERSION_OPENSSL=openssl-1.0.2d
export VERSION_NGINX=nginx-1.9.7
# URLs to the source directories
soheilhy /
Last active Apr 2, 2020
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for,, and on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

paulmach / serve.go
Last active Mar 27, 2020
Simple Static File Server in Go
View serve.go
Serve is a very simple static file server in go
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
package main
dongyuwei / horizontal-infinite-carousel.html
Created Jun 26, 2013
infinite loop carousel(vertical or horizontal)
View horizontal-infinite-carousel.html
andelf / sendMail.go
Last active Mar 25, 2020
golang send mail net/smtp SMTP
View sendMail.go
package main
import (
victusfate / canvas_bkg.js
Created Jun 28, 2012
creates a dynamic color pattern canvas on mouse move event
View canvas_bkg.js
var body, canvas, color, ctx, grad, canvasAdjust=true;
canvas = document.getElementsByTagName("canvas")[0];
ctx = null;
grad = null;
body = document.getElementsByTagName("body")[0];
color = 255;
if (canvas.getContext("2d")) {
var w = canvas.width;
var h = canvas.height;
ctx = canvas.getContext("2d");
jwo / registrations_controller.rb
Created Sep 30, 2011
API JSON authentication with Devise
View registrations_controller.rb
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user =[:user])
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>, :status=>201
fnichol /
Created Mar 12, 2011
Download a cacert.pem for RailsInstaller


There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?


The Ruby Way! (Fun)

You can’t perform that action at this time.