Moved to Medium
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 bash | |
# - consumes a list of URL paths from a file called `paths.txt` (a simple | |
# new-line separated list), | |
# - concatenates them with base URLs (that can be defined with environment | |
# variables), | |
# - hits these URLs every <interval> seconds in a seqential way | |
# - waits a little longer every <batch> and <bigBatch> URLs to ease out | |
# the pressure on your server |
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 bash | |
for directory in */ ; do | |
dirTimestamp="$(GetFileInfo -d "$directory")" | |
( | |
cd "$directory" | |
# In this case img files have no extensions | |
for fileName in `find . -type f -maxdepth 1 ! -name "*.*"`; do | |
fileTimestamp="$(GetFileInfo -d "$fileName")" |
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
import React, { Component } from 'react' | |
import { withRouter } from 'react-router' | |
const topCoordinates = [0, 0] | |
const { scrollTo } = window | |
class ScrollToTopHandler extends Component { | |
// Arrow method, requires stage 2 Babel preset | |
render = () => null |
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
# Get the most recent commit ID | |
git rev-parse HEAD | |
# Detect if feature branch has been rebased on master | |
git checkout <your-feauture-branch> | |
git checkout master | |
masterHeadId=`git rev-parse HEAD` |
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
// Low-level, generic validation functions | |
// Signature: any => boolean | |
const hasLength = value => value.length > 0 | |
const hasLettersAndDotsOnly = value => ( | |
value.match(/^[a-z\.]+$/gi) !== null | |
) | |
/* | |
Map input fields to "types" that we want to validate in a certain way. 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
export default function buildObjectFromClass (className) { | |
return Object.getOwnPropertyNames(className.prototype) | |
.filter(propertyName => propertyName != 'constructor') | |
.reduce((result, propertyName) => { | |
result[propertyName] = className.prototype[propertyName] | |
return result | |
}, {}) | |
} |
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 bash | |
baseBranch=master | |
if [[ $# -eq 1 ]]; then | |
baseBranch=$1 | |
fi | |
echo "Update the repository..." | |
git fetch -p | |
echo |
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 delay(milliseconds) { | |
return new Promise( | |
resolve => setTimeout(resolve, milliseconds) | |
) | |
} |
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
render () { | |
const { visible } = this.props | |
let visibleContent | |
if (visible) { | |
visibleContent = this.getVisibleContent() | |
} | |
return ( | |
<div className={ visible ? 'expanded' : 'collapsed' }> | |
{ visibleContent } // No more logic here and useless "null" |