Skip to content

Instantly share code, notes, and snippets.

View Micka33's full-sized avatar

Mickaël CASSY Micka33

View GitHub Profile
@Micka33
Micka33 / nginxproxy.md
Created October 15, 2015 15:36 — forked from soheilhy/nginxproxy.md
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 example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

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

@Micka33
Micka33 / unbounce.md
Last active June 29, 2021 08:59
unbounce validator messages

#Code à mettre:

(function(e){function t(){var t=window.module.lp.form.data;var n=t.validationMessages;var r=t.validationRules;this.changeTitle=function(n){e(function(){e("#"+t.errorContainerId).find("div.error").text(n)})};this.changeField=function(e,t,i){if(!n[e])return;n[e].required=t;if(i&&r[e].email)n[e].email=i;if(i&&r[e].phone)n[e].phone=i}}window.errors=new t(lp.jQuery)})(lp.jQuery)
$(function() {
 setTimeout(function(){

   lp.jQuery.validator.addMethod("phone", function(phone_number, element)
   {
    phone_number = phone_number.replace(/\s+/g, "");
@Micka33
Micka33 / install.md
Last active March 17, 2022 10:55
cassandra on mac OSX

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@Micka33
Micka33 / text.md
Last active August 29, 2015 14:04
Rspec avec capybara

#capybara_helper.rb

require 'rails_helper'
require 'capybara/rspec'

Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

RSpec.configure do |config|
  config.extend FeatureMacros, :type => :feature
  Capybara.javascript_driver = :webkit
@Micka33
Micka33 / package.json
Last active August 29, 2015 14:03
A NodeJS server allow clients to subscribe/unsubscribe to rooms
{
"name": "pubsub",
"version": "0.0.1",
"dependencies": {
"express": ">=2.4.3",
"socket.io": ">=0.7.8",
"underscore": "",
"redis": "",
"zlib": "",
"js-yaml": "",
@Micka33
Micka33 / README.md
Last active August 29, 2015 14:02
An AngularJS module that load raw json datas from the html on load

#Why rawData (reminder)

Because I don't want to have two requests to load one page (one for the squeleton, one for the datas).
So I want to embed the datas in my page on the first request to load them directly.

#How to use rawData

<div>
 {{the_datas}}
@Micka33
Micka33 / package.json
Created June 13, 2014 13:41
Socket.io / Redis server
{
"name": "vacuumnodeserver",
"version": "0.0.0",
"description": "",
"main": "server.js",
"dependencies": {
"js-yaml": "~3.0.2",
"moment": "~2.6.0",
"http": "~0.0.0",
"socket.io": "~0.9.16",
@Micka33
Micka33 / socketio.js
Created April 10, 2014 09:43
Angularjs wrapper for socket.io
admin.factory('$socket', ['$rootScope', function ($rootScope) {
if (typeof io != 'undefined')
var socket = io.connect();
return {
connect: function (url) {
if (typeof io != 'undefined')
socket = io.connect(url);
},
on: function (eventName, callback) {
if (typeof socket != 'undefined')
@Micka33
Micka33 / test_riak-cs.md
Last active August 29, 2015 13:57
Test riak-cs

Substitute riak-cs by netcat to vatch the sent request

$> nc  -l 127.0.0.1 8080
PUT /53208b5294da268379000001?AWSAccessKeyId=O_5H9U1UTJNVB5MDNM0O&Expires=1394677746&Signature=IjMEUg%2BH%2FP7SP5nx4KW7gXJ6h8g%3D HTTP/1.1
Host: 52aed41a94da26d8fa000001.data.riak.dev
Content-Length: 2831
x-amz-acl: public-read
...