git push -u origin feature_branch_name
git fetch
git checkout test
" inner word | |
iw | |
" around word | |
aw | |
" a sentence | |
as | |
" inner sentence |
import React from "react"; | |
import { render } from "react-dom"; | |
const ParentComponent = React.createClass({ | |
getDefaultProps: function() { | |
console.log("ParentComponent - getDefaultProps"); | |
}, | |
getInitialState: function() { | |
console.log("ParentComponent - getInitialState"); | |
return { text: "" }; |
/** | |
* JavaScript's typeof method returns "object" for arrays and null values. This fixes that. | |
* http://javascript.crockford.com/remedial.html | |
*/ | |
function typeOf(value) { | |
var s = typeof value; | |
if (s === 'object') { | |
if (value) { | |
if (value instanceof Array) { | |
s = 'array'; |
# This works in the Flask debugging console as well. | |
# Very handy for pretty output of Python dictionaries | |
# Source: http://stackoverflow.com/questions/3733554/howto-format-dict-string-outputs-nicely | |
import json | |
x = {'planet' : {'has': {'plants': 'yes', 'animals': 'yes', 'cryptonite': 'no'}, 'name': 'Earth'}} | |
print json.dumps(x, indent=2) | |
""" | |
Output: |
# Show security updates only: | |
apt-get -s dist-upgrade |grep "^Inst" |grep -i securi | |
# Show all upgradeable packages | |
apt-get -s dist-upgrade | grep "^Inst" | |
# Install security updates only |
// Generates a URL-friendly "slug" from a provided string. | |
// For example: "This Is Great!!!" transforms into "this-is-great" | |
function generateSlug (value) { | |
// 1) convert to lowercase | |
// 2) replace anything that's not an alphanumeric character or dash with a dash | |
// 3) replace instances of more than one dash with a single dash | |
// 4) remove leading and trailing dashes | |
return value.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, ''); | |
}; |