Skip to content

Instantly share code, notes, and snippets.

View lorenzoplanas's full-sized avatar
💭
🏖️

Lorenzo Planas lorenzoplanas

💭
🏖️
View GitHub Profile
@zerowidth
zerowidth / paginated_collection.js
Created November 18, 2010 22:04
first whack at pagination with backbone.js
// includes bindings for fetching/fetched
PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
this.page = 1;
},
fetch: function(options) {
options || (options = {});
this.trigger("fetching");
@clintongormley
clintongormley / gist:1088986
Created July 18, 2011 09:19
Create index for partial matching of names in ElasticSearch
# First, create the synonyms file /opt/elasticsearch/name_synonyms.txt
# with the contents:
#
# rob,bob => robert
#
## CREATE THE INDEX WITH ANALYZERS AND MAPPINGS
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
{
@clintongormley
clintongormley / gist:1089180
Created July 18, 2011 10:58
Example name query
curl -XGET 'http://127.0.0.1:9200/test/member/_search?pretty=1' -d '
{
"query" : {
"bool" : {
"should" : [
{
"text" : {
"first_name" : {
"boost" : 1,
"query" : "rob smith"
@ngauthier
ngauthier / em_syslog2.rb
Created December 12, 2011 21:30
An EventMachine Syslog Protocol
# this is a configurable version of an EventMachine syslogger
# It was build to replace https://github.com/melito/em-syslog
#
# You can instantiate many of them (no global variables) as
# well as configure the facility. It also quacks like a ruby
# logger so it can be interchanged with a ruby logger.
#
# Example:
#
# # 11 is the facility code for an FTP daemon
@mxriverlynn
mxriverlynn / Backbone.ModelRouter.js
Created December 13, 2012 17:06
Backbone.ModelRouter - Resolve an :id parameter is a `.modelRoutes` hash, to load a model and then run the callback method with the specified model as the arguments, instead of the id parameter
// Backbone.ModelRouter
// --------------------
//
// v0.0.0
//
// Resolve an :id parameter is a `.modelRoutes` hash, to load
// a model and then run the callback method with the specified
// model as the arguments, instead of the id parameter.
//
// Copyright (C) 2012 Muted Solutions, LLC. All Rights Reserved.
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@SzymonPobiega
SzymonPobiega / gist:5220595
Last active April 25, 2024 17:19
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@kidpixo
kidpixo / PostGIS 2.0 Cheatsheet.md
Last active February 3, 2024 23:56
PostGIS 2.0 Cheatsheet
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active July 10, 2024 14:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@xaviershay
xaviershay / mobility.md
Last active December 28, 2015 15:29
Mobility routine, 17th November 2013

Time: 25-30 minutes.

Goal: Better back, front, and overhead squats. Very basic gymnastic conditioning.

"Limber 11" ([video][limber-11])

  • Foam roll ITB, 10 passes
  • Foam roll aductors, 10 passes
  • Ball glutes, 30-60s each
  • Bent leg cross, 5 each side