Skip to content

Instantly share code, notes, and snippets.

View grangier's full-sized avatar
🦄
On vacation

Xavier Grangier grangier

🦄
On vacation
View GitHub Profile

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at [email protected] or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

@grangier
grangier / gist:3825368
Created October 3, 2012 06:18 — forked from perusio/gist:1326701
Mobile device detection in Nginx with just 7 lines of configuration
### Testing if the client is a mobile or a desktop.
### The selection is based on the usual UA strings for desktop browsers.
## Testing a user agent using a method that reverts the logic of the
## UA detection. Inspired by notnotmobile.appspot.com.
map $http_user_agent $is_desktop {
default 0;
~*linux.*android|windows\s+(?:ce|phone) 0; # exceptions to the rule
~*spider|crawl|slurp|bot 1; # bots
~*windows|linux|os\s+x\s*[\d\._]+|solaris|bsd 1; # OSes
@grangier
grangier / goose-jruby-example.rb
Created December 26, 2011 05:25 — forked from lusis/goose-jruby-example.rb
Example of using Goose from JRuby
require 'rubygems'
require 'java'
require 'chronic'
libs = []
libs << "lib/jars/*.jar"
libs.each do |lib|
Dir[lib].each do |jar|
@grangier
grangier / json-response.py
Created December 25, 2011 09:45 — forked from leah/json-response.py
JSONResponse classes
import re
import simplejson
from django.http import HttpResponse
from django.conf import settings
class JSONResponse(HttpResponse):
def __init__(self, request, data):
indent = 2 if settings.DEBUG else None