Skip to content

Instantly share code, notes, and snippets.

View santihbc's full-sized avatar
💭
Edpuzzlin'

Santi Herrero santihbc

💭
Edpuzzlin'
View GitHub Profile
files:
/etc/nginx/conf.d/gzstatic.conf:
content: |
server {
server_name www.urcourz.com;
listen 8080;
location ~* \.(js|css|html)$ {
root /var/app/current/public;
}
@santihbc
santihbc / gist:9858336
Created March 29, 2014 17:15
New Relic Browser Monitoring - 1st attempt (metacode)
/* app.js file. Main file where the Express app is initialized */
...
// All the requests except for our external API go through the same route and render index.js
app.get(/^((?!\/api\/).)/, csrf, routes.index);
...
/* index.js */
var newrelic = require('newrelic');
# mod_deflate configuration
<IfModule mod_deflate.c>
# Restrict compression to these MIME types
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xml+rss
AddOutputFilterByType DEFLATE application/x-javascript
// directly uploads to S3
// See http://philfreo.com/blog/how-to-allow-direct-file-uploads-from-javascript-to-amazon-s3-signed-by-python/
// See https://github.com/elasticsales/s3upload-coffee-javascript
editors.Filepicker = editors.Text.extend({
tagName: 'div',
events: {
'change input[type=file]': 'uploadFile',
(function addXhrProgressEvent($) {
var originalXhr = $.ajaxSettings.xhr;
$.ajaxSetup({
progress: function() { console.log("standard progress callback"); },
xhr: function() {
var req = originalXhr(), that = this;
if (req) {
if (typeof req.addEventListener == "function") {
req.addEventListener("progress", function(evt) {
that.progress(evt);
// Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload
var fs = require('fs');
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./aws-config.json');
var s3 = new AWS.S3();
// File
var fileName = '5.pdf';
var filePath = './' + fileName;
var fileKey = fileName;
var o = $({});
$.subscribe = o.on.bind(o);
$.publish = o.trigger.bind(o);
@santihbc
santihbc / .vimrc
Created October 21, 2013 02:31 — forked from JeffreyWay/.vimrc
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
@santihbc
santihbc / README.md
Created September 8, 2013 17:35 — forked from mbostock/.block

This example demonstrates how to add visible and draggable handles to D3’s d3.svg.brush component, rather than that relying on the invisible boundary of the brush extent. The handle sizes here are exaggerated for demonstration purposes!

describe 'App.HeaderModule', ->
beforeEach ->
@headerModule = window.App.HeaderModule
it 'should exist', ->
expect(@headerModule).not.toBeUndefined()
describe 'starting', ->