Skip to content

Instantly share code, notes, and snippets.

Avatar

Matteo Rosati mrosati84

View GitHub Profile
@mrosati84
mrosati84 / settings.php
Created Nov 22, 2016
Drupal 8 reverse proxy settings
View settings.php
<?php
/**
* Reverse Proxy Configuration:
*
* Reverse proxy servers are often used to enhance the performance
* of heavily visited sites and may also provide other site caching,
* security, or encryption benefits. In an environment where Drupal
* is behind a reverse proxy, the real IP address of the client should
* be determined such that the correct client IP address is available
@mrosati84
mrosati84 / .vimrc
Last active Mar 8, 2017
My .vimrc file
View .vimrc
execute pathogen#infect()
syntax on
set ruler " show the line number on the bar
set more " use more prompt
set autoread " watch for file changes
set number " line numbers
set autoindent smartindent " auto/smart indent
set smarttab " tab and backspace are smart
filetype on " Enable filetype detection
@mrosati84
mrosati84 / drag_to_upload.js
Last active Aug 29, 2015
A super-simple jQuery plugin that handles drag-to-upload files
View drag_to_upload.js
(function(window, document, $) {
'use strict';
if ( ! String.hasOwnProperty('hashCode') ) {
/**
* returns a hash code from a base string
* @return {string}
*/
String.prototype.hashCode = function() {
var hash = 0, i, chr, len;
@mrosati84
mrosati84 / devify
Last active Aug 29, 2015
Easily manage projects using H-ART Dev Machine
View devify
#!/bin/bash
# create Dev Machine structure
function createStructure {
# TODO
# 1- check existing folders
# 2- ask user for overwriting
if [ -d manifests ] ||
[ -d modules ] ||
[ -d xdebug ] ||
View angular_services.html
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title></title>
</head>
<body ng-controller="MainCtrl">
{{ menu }}
<div>
@mrosati84
mrosati84 / toggleClass.html
Created Oct 2, 2013
Simple toggleClass implemented in AngularJS
View toggleClass.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.is-active {
color: red;
}
</style>
@mrosati84
mrosati84 / capture.js
Last active Aug 3, 2016
Test automation for responsive layout using PhantomJS
View capture.js
/*
requires: phantomjs, async
usage: phantomjs capture.js
*/
var async = require('async'),
sizes = [
[320, 480],
[1024, 768],
[1280, 800],
@mrosati84
mrosati84 / angular_http_request
Created Mar 13, 2013
An Angular.js example for making XHR calls
View angular_http_request
---
The html file "index.html"
---
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.min.js"></script>
@mrosati84
mrosati84 / tmux.conf
Last active Mar 8, 2017
My tmux configuration file
View tmux.conf
unbind C-b
set -g default-terminal screen-256color
set -g prefix C-a
bind C-a send-prefix
# fiddle with colors of status bar
set -g status-fg white
set -g status-bg colour234
# fiddle with colors of inactive windows
@mrosati84
mrosati84 / restful_pattern.txt
Created Jan 5, 2013
Restful resource definition pattern
View restful_pattern.txt
GET /photos index display a list of photos
GET /photos/new new return an HTML form for creating a new photo
POST /photos create create a new photo
GET /photos/:id show display a specific photo
GET /photos/:id/edit edit return an HTML form for editing a new photo
PUT /photos/:id update update a specific photo
DELETE /photos/:id destroy delete a specific photo