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
//------------START------------------------------------------------------------------------------------------------ | |
async function start(context,$,site,typeDeCrawl){ | |
context.log.info('remote file => start') | |
site = (context.customData && context.customData.site) ? context.customData.site : site | |
typeDeCrawl = (context.customData && context.customData.typeDeCrawl) ? context.customData.typeDeCrawl : typeDeCrawl | |
switch (context.request.userData.label) { | |
case 'home': | |
return await case_home(context,site,typeDeCrawl); | |
case 'search': |
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
//------------START------------------------------------------------------------------------------------------------ | |
function start(context,$,_,site,typeDeCrawl){ | |
site = (context.customData && context.customData.site) ? context.customData.site : site | |
typeDeCrawl = (context.customData && context.customData.typeDeCrawl) ? context.customData.typeDeCrawl : typeDeCrawl | |
switch (context.request.label) { | |
case 'home': | |
case_home(context,site,typeDeCrawl); | |
break; | |
case 'search': | |
case_search(context,$,_,site,typeDeCrawl); |
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
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
//A simple function to flatten a javascript object, with a '.' delimiter between nested levels | |
const flatten = (objectOrArray, prefix = '', formatter = (k) => (k)) => { | |
const nestedFormatter = (k) => ('.' + k) | |
const nestElement = (prev, value, key) => ( | |
(value && typeof value === 'object') | |
? { ...prev, ...flatten(value, `${prefix}${formatter(key)}`, nestedFormatter) } | |
: { ...prev, ...{ [`${prefix}${formatter(key)}`]: value } }); | |
return Array.isArray(objectOrArray) | |
? objectOrArray.reduce(nestElement, {}) |
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
# Add field | |
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}' | |
# { | |
# "hello": "world", | |
# "foo": "bar" | |
# } | |
# Override field value | |
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}' | |
{ |
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 | |
# shellcheck disable=SC2016,SC2119,SC2155 | |
# | |
# Shellcheck ignore list: | |
# - SC2016: Expressions don't expand in single quotes, use double quotes for that. | |
# - SC2119: Use foo "$@" if function's $1 should mean script's $1. | |
# - SC2155: Declare and assign separately to avoid masking return values. | |
# | |
# You can find more details for each warning at the following page: | |
# https://github.com/koalaman/shellcheck/wiki/<SCXXXX> |
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
# bash/zsh completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# | |
# *) local and remote branch names | |
# *) local and remote tag names |
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 | |
# Sexy bash prompt by twolfson | |
# https://github.com/twolfson/sexy-bash-prompt | |
# Forked from gf3, https://gist.github.com/gf3/306785 | |
# If we are on a colored terminal | |
if tput setaf 1 &> /dev/null; then | |
# Reset the shell from our `if` check | |
tput sgr0 &> /dev/null |