pwgen -Cs 20 1 | tr -d ' ' | tr -d '\n' | pbcopy
This file contains hidden or 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
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: "" }; |
This file contains hidden or 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
/** | |
* 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 file contains hidden or 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
# 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: |
This file contains hidden or 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 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 |
This file contains hidden or 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
// 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, ''); | |
}; |
This file contains hidden or 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
" inner word | |
iw | |
" around word | |
aw | |
" a sentence | |
as | |
" inner sentence |