Models | Examples |
---|---|
Display ads | Yahoo! |
Search ads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx React.DOM */ | |
var React = require('react'); | |
var Router = require('react-router'); | |
var whenKeys = require('when/keys'); | |
var EventEmitter = require('events').EventEmitter; | |
var { Route, DefaultRoute, NotFoundRoute, ActiveRouteHandler } = Router; | |
var { Link, Navigation, ActiveState } = Router; | |
var API = 'http://addressbook-api.herokuapp.com'; | |
var loadingEvents = new EventEmitter(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ctrlp.vim plug-in | |
" open files extra files in hidden buffers | |
let g:ctrlp_open_multiple_files = '1jr' | |
" indexing speed up | |
if has("unix") | |
let g:ctrlp_user_command = { | |
\ 'types': { | |
\ 1: ['.git', 'cd %s && git ls-files'], | |
\ 2: ['.hg', 'hg --cwd %s locate -I .'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var query = "select {[Measures].[Sales Amount], " + | |
"[Measures].[Average Sales Amount]} ON COLUMNS, " + | |
"[Product].[All Products].Children ON ROWS" + | |
" From [Sales Summary]"; | |
var rowset = function(mdx){ | |
xmla = new Xmla(); | |
return xmla.execute({ | |
async: false, | |
url: "http://localhost/olap/msmdpump.dll", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- PostgreSQL 9.2 beta (for the new JSON datatype) | |
-- You can actually use an earlier version and a TEXT type too | |
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8 | |
-- Inspired by | |
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html | |
-- http://ssql-pgaustin.herokuapp.com/#1 | |
-- JSON Types need to be mapped into corresponding PG types | |
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The basic idea here is to substantiate the claims made by this square post: | |
http://corner.squareup.com/2011/06/postgresql-data-is-important.html | |
In PostgreSQL, and MySQL (MyISAM and InnoDB) I create millions of rows and then add | |
and remove columns and add and remove indexes. For columns without defaults this is | |
basically free in PostgreSQL and O(n) in MySQL. For adding indexes its at best O(n) | |
everywhere, but with PostgreSQL it claims not to do any locking that would otherwise | |
prevent table interaction. | |
Also, PostgreSQL has _awsome_ documentation (it has real examples!). I always get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Okay so here's the setup: | |
[-] The primary server API is exposed via Flask (Python) and all static files, including all html, css, js is served by nginx. | |
[-] Python is exposing an API at url http://domain.com/api/download/<file_id>, where file_id is a database id for the file that we're interested in downloading. | |
1. User wants to download a file, so we spawn a new window with the url '/api/download/<file_id>' | |
2. Nginx intercepts the request, sees that it starts with /api/, and then forwards the request to Flask, which is being served on port 5000. | |
3. Flask routes the request to its download method, retrieves the pertinent data from the file_id, and constructs additional header settings to make nginx happy and to force the browser to see the file stream as a download request instead of the browser just trying to open the file in a new window. Flask then returns the modified header stream to nginx | |
4. Nginx is finally ready to do some work. While parsing the headers for the incoming request, it encounters "X |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove any non-ASCII characters and convert known non-ASCII characters | |
* to their ASCII equivalents, if possible. | |
* | |
* @param string $string | |
* @return string $string | |
* @author Jay Williams <myd3.com> | |
* @license MIT License | |
* @link http://gist.github.com/119517 |