/*
Read a ini file
[Section1]
Param1=value1
[Section2]
Param2=value2
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
// | |
// useTime hook | |
// | |
import { useEffect, useState } from 'react'; | |
export const useTime = (refreshCycle = 100) => { | |
// Returns the current time | |
// and queues re-renders every `refreshCycle` milliseconds (default: 100ms) | |
const [now, setNow] = useState(getTime()); |
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
// Component.js | |
const Component = props => ( | |
<MyContext.Consumer> | |
{(context) => ( | |
<Foo | |
bar={props.bar} | |
baz={context.baz} | |
/> | |
)} | |
</MyContext.Consumer> |
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
/** | |
* This file provides common stuff to be used in the pipelines. | |
* It is important to load it after repo checkout is done: see https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#triggering-manual-loading | |
* | |
*/ | |
/** | |
* Dumps some info about the environment. | |
* @return | |
*/ |
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
#!/bin/sh | |
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$") | |
ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint" | |
if [[ "$STAGED_FILES" = "" ]]; then | |
exit 0 | |
fi | |
PASS=true |
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
const fs = require('fs'); | |
const args = process.argv.slice(2); | |
const options = args | |
.reduce((result, arg) => { | |
const splittedArg = arg.split('='); | |
const key = splittedArg[0].replace('--', ''); | |
const value = splittedArg[1]; | |
result[key] = value; |
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
package main | |
import ( | |
"database/sql/driver" | |
"encoding/json" | |
"github.com/jinzhu/gorm" | |
_ "github.com/lib/pq" | |
) |
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 io.appium.java_client.AppiumDriver; | |
import io.appium.java_client.ios.IOSDriver; | |
import io.appium.java_client.remote.MobileBrowserType; | |
import io.appium.java_client.remote.MobileCapabilityType; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
import org.testng.annotations.AfterClass; | |
import org.testng.annotations.BeforeClass; | |
import org.testng.annotations.Test; |
Python syntax here : 2.7 - online REPL
Javascript ES6 via Babel transpilation - online REPL
import math
NewerOlder