Skip to content

Instantly share code, notes, and snippets.

View dbani-dev's full-sized avatar
🔨
Working...

David Bani dbani-dev

🔨
Working...
  • Shell Energy
  • Perth, Western Australia
View GitHub Profile
class PollingReports {
constructor(
dataProviderId,
siteSelections,
values,
pollingInterval,
pollingMaxAttempts
) {
super();
this.dataProviderId = dataProviderId;
class PollingBase {
poll = async ({ fn, validate, interval, maxAttempts = 10 }) => {
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
for (let attempts = 0; attempts < maxAttempts; attempts++) {
try {
const result = await fn()
if (validate(result)) {
return result
class PollingBase {
poll = async ({ fn, validate, interval, maxAttempts }) => {
try {
let attempts = 0;
const executePoll = async (resolve, reject) => {
try {
const result = await fn();
attempts++;
console.log({ result });
// example 1
const target = DeviceInfo.getBundleId(); // only can get this variable when bundle loads = appA, appB
const testImport = import(`component.${target}`); // bundle fails, doesnt know what target is
@dbani-dev
dbani-dev / gist:3da1c44c33e4688d12027c8cc4ff186f
Created January 2, 2018 00:15 — forked from scottious/gist:0d99ea77daa041b28929
__git_ps1 command not found issue.

I've been having an issue with the following error appear in the prompt after upgrading to Yosemite. The solution was to source the git bash completion and prompt files from a local copy.

    curl -o ~/.git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
    curl -o ~/.git-prompt.sh https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh

Then in:

    vi ~/bash_profile

Add:

class ToolbarStatus extends Component {
constructor(props) {
super(props);
}
componentWillReceiveProps(nextProps) {
if (!nextProps.isFetching && !nextProps.isFailure) {
const styles = StyleSheet.create({
eventItem: {
flex: 1,
alignItems: 'flex-end'
},
eventHighlight: {
flexDirection: 'row',
borderWidth: 1,
borderStyle: 'solid',
paddingTop: 1,
const initialState = Immutable.fromJS({
status: null,
error: null,
items: Immutable.List([]),
nested: {
test: 'a',
groups: {
users: []
}
}
class ExampleComponent extends Component {
constructor() {
super();
this.state = {
data: null
}
}
class ExampleComponent extends Component {
constructor() {
super();
}
// When the ExampleComponent is ready
componentDidMount() {
// Get data from API
fetch('https://swapi.co/api/people/?page=1')