command | pip | bundler | npm | bower |
---|---|---|---|---|
Init | touch requirements.txt |
bundle init |
npm init |
bower init |
List installed packages | pip freeze or pip list |
bundle list |
npm ls -g --depth 0 |
bower list |
Search for a package | npm search <name> |
bower search |
||
Install a package | pip install <name> |
npm install <name> --save-dev |
bower install <name> |
|
Install everything | pip install -r requirements.txt |
bundle install |
npm install |
|
List outdated packages | pip list --outdated |
bundle outdated |
npm outdated |
|
Update everything | pip install --upgrade |
bundle update |
`npm update --s |
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
Show hidden characters
{ | |
"browser": true, | |
"strict": false, | |
"globals": { | |
"QUnit": false, | |
"module": false, | |
"test": false, | |
"asyncTest": false, | |
"expect": false, | |
"start": false, |
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
# Invoke cheat | |
function inv { | |
# if no parameters, then assume we want to list tasks | |
if [ -z $1 ]; then | |
invoke --list | |
else | |
# invoke expects --help to be first, so move it if it isn't | |
local numargs=$# | |
for ((i=2; i <= numargs ; i++)) | |
do |
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
#!/usr/bin/env python3 | |
""" | |
Usage: ./2geojson.py [<yaml_file> | <address>] | |
Requirements: | |
pip3 install PyYAML geopy | |
""" | |
import json |
GET /_cat/indices?v
Count documents
[/index_name]/_count
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
#### PROMETHEUS ################################## | |
.PHONY: prom | |
# add-host hack: | |
# https://github.com/docker/docker/issues/1143#issuecomment-70052272 | |
prom: prom_exp prom_node | |
-@docker rm -f $@_1 > /dev/null | |
docker run -d --name $@_1 \ | |
-v ${PWD}/prom/prometheus.conf:/prometheus.conf:ro \ | |
-v ${PWD}/prom/data:/prometheus \ |
Picking a testable ajax library for react (using jest)
Here are some examples of doing a GET
request against a resource and getting JSON back.
Works. Works great. It just brings along a lot of baggage you won't need in a ReactJS app. Removing jQuery will remove over 200KB (unminified/gzipped).
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
jQuery.fn.sort = function() { return this.pushStack( [].sort.apply( this, arguments ), []); }; | |
$('.djDebugSql').closest('tr').each(function(i) { this.setAttribute('rel',i); }); | |
function dtsql(o){ | |
switch (o) { | |
case 'clean' : $('.djDebugSql').each(function(){ $(this).contents()[1].nodeValue = ' '; }); break; | |
case 'time' : tbody = $('.djDebugSql:eq(0)').closest('tbody'); tbody.children('tr').sort(function(a,b){ return $(b).children('td:eq(0)').html() - $(a).children('td:eq(0)').html() }).appendTo(tbody); | |
break; | |
} | |
} | |
dtsql('time'); |
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
from django.test.client import Client | |
def render_url(url): | |
c = Client() | |
return c.get(url).content |
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
# based on http://stackoverflow.com/questions/797773/django-caching-can-it-be-done-pre-emptively | |
# run this from `manage.py shell` | |
# if you have ipython, you can do `what_view /some/silly/url/` and remember the leading and trailing slash | |
from django.core.urlresolvers import resolve | |
def what_view(url): | |
try: | |
(v, foo, params) = resolve(url) | |
print "View Name: %s Line: %s of %s" % (v.__name__, v.__code__.co_firstlineno, v.__code__.co_filename) | |
return v, foo, params | |
except: |
OlderNewer