Skip to content

Instantly share code, notes, and snippets.

View bulkan's full-sized avatar
🇯🇵

Savun Bulkan Evcimen bulkan

🇯🇵
View GitHub Profile
@bulkan
bulkan / 0_reuse_code.js
Created April 15, 2014 05:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
// State example:
//
// $stateProvider
// .state('state', {
// url: 'state/:id',
// template: stateTemplate,
// controller: stateController,
// // Expose parameters in display names using {:param} syntax
// displayName: 'State ({:id})'
// });
var fs = require('fs')
var Q = require('q')
var fs_stat = Q.denodeify(fs.stat)
var fs_readdir = Q.denodeify(fs.readdir)
var files = [
'./fixtures/file1',
'./fixtures/file2',
'./fixtures/file3',
'./fixtures/file4'
// knockout 2.2.1
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
ko.utils.arrayGetDistinctValues = function (array) { /* .. */ }

Flask + uWSGI + nginx Primer

I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

How this shit works

  • Flask is managed by uWSGI.
  • uWSGI talks to nginx.
def getLocationMap():
locations=Location.objects.all().order_by('-date')
location_array={}
for location in locations:
location_array[location.id]=[str(location.longitude),(location.latitude),location.note,location.title]
return location_array
//JAVASCRIPT
var location_array= $.parseJSON("{{ location_array }}");