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
/** | |
* Session Storage for multi servers ex.Heroku stacks | |
* for expressjs socket.io with databases redis and mongodb | |
* (redis/socket.io) | |
* (mongodb/expressjs) | |
* | |
* Bradley Matusiak @ 2012 bmatusiak@gmail.com | |
* | |
* ref:bunch of searches from google | |
**/ |
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
* Reducing executable size: | |
http://developer.xamarin.com/guides/cross-platform/deployment,_testing,_and_metrics/memory_perf_best_practices/#Reducing_Executable_Size | |
* Use the linker (iOS [1], Android [2]) to remove unnecessary code from your assemblies | |
[1] https://developer.xamarin.com/guides/ios/advanced_topics/linker | |
[2] https://developer.xamarin.com/guides/android/advanced_topics/linking | |
* Reference third-party libraries judiciously | |
* Applying constraints to generics may reduce app size, since less code would need to be included (haven’t verified this) |
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
$ brew install libmagic | |
$ brew link libmagic (if the link is already created is going to fail, don't worry about that) | |
$ env ARCHFLAGS="-arch x86_64" gem install ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/ |
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
#!/bin/bash | |
#Create python module command | |
create_py_module() { | |
mkdir $1; | |
touch $1/__init__.py | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
class Node(object): | |
def __init__(self, data, next_node=None): | |
self.data = data | |
self.next_node = dict() | |
self._freq = 1 | |
def add(self, data): | |
if data in self.next_node: | |
self.next_node[data]._freq += 1 | |
else: |
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
sudo rm /var/lib/apt/lists/lock |
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
function _uuid() { | |
function _() { | |
var rand = Math.ceil(1e15 + Math.random() * 1e5).toString(16); | |
return rand.substring(rand.length - 4); | |
} | |
return _() + _() + '-' + _() + '-' + _() + '-' + _() + '-' + _() + _(); | |
} |
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
def format_data(query=None, model_instance=None, filters=None, exclude=None, order_by=None, extra_field=None): | |
if model_instance: | |
query = model_instance.objects.all() | |
if filters: | |
query = query.filter(**filters) | |
if exclude: | |
query = query.exclude(**exclude) | |
if order_by: | |
query = query.order_by(*tuple(order_by)) |
OlderNewer