Save file even if it was opened without write permissions
:w !sudo tee %
Write/append lines from file to another file (optionally overwrite)
:5,25w [!] [>>] new_file
render () { | |
const { visible } = this.props | |
return ( | |
<div className={ visible ? 'expanded' : 'collapsed' }> | |
{ | |
visible ? <div> | |
// Dozens of lines of JSX code here | |
// Dozens of lines of JSX code here | |
// Dozens of lines of JSX code here | |
// Dozens of lines of JSX code here |
class TextInputControl extends _react2.default.Component { | |
constructor(props) { | |
super(props); | |
this.bindInstanceMethods('handleBlurEvent', 'handleChangeEvent'); | |
this.handleChangeEventDebounced = (0, _debounce2.default)(this.handleChangeEvent, props.inputChangeDebounceWait); | |
} | |
bindInstanceMethods(...methods) { | |
methods.forEach(method => this[method] = this[method].bind(this)); |
{ | |
"presets": ["react"], | |
"plugins": ["transform-es2015-modules-commonjs"] | |
} |
#!/usr/bin/env bash | |
mkdir Tools | |
cd Tools | |
ln -s /Applications/Utilities/Activity\ Monitor.app Activity\ Monitor | |
ln -s /Applications/Android\ Studio.app Android\ Studio | |
ln -s /Applications/Atom.app Atom | |
ln -s /Applications/Automator.app Automator | |
ln -s /Applications/CocoaRestClient.app CocoaRestClient |
{ | |
"presets": ["es2015", "react"] | |
} |
function calculateMedian( array ) { | |
var arraySize = array.length | |
if ( arraySize === 1 ) { | |
return array[0] | |
} | |
var isOddLength = isOdd( arraySize ), | |
middleIndex = Math.floor( arraySize / 2.0 ) | |
array.sort( subtract ) |
WindowResizeManager = function( debounceWait ) { | |
this.debounceWait = debounceWait || 200; | |
_.bindAll(this, "handleWindowResizeEvent", "triggerWindowResizeCompleteEvent"); | |
this.cacheDom(); | |
this.bindWindowResizeEvent(); | |
}; | |
WindowResizeManager.prototype.cacheDom = function() { | |
this.window: $(window); | |
}; |
function isPalindrome( string ) { | |
var notWordPattern = /\W/g, | |
alphaNumericOnly = string | |
.replace( notWordPattern, "" ) | |
.toLowerCase(), | |
alphaNumericOnlyReversed = alphaNumericOnly.reverse() | |
return alphaNumericOnly == alphaNumericOnlyReversed | |
} |
module.exports = function() { | |
var faker = require("faker"), | |
_ = require("lodash"); | |
return { | |
people: _.times(100, function (n) { | |
return { | |
id: n, | |
name: faker.name.findName(), | |
jobTitle: faker.name.jobTitle() | |
} |