Skip to content

Instantly share code, notes, and snippets.

View gilbarbara's full-sized avatar
💥
Keep Buggering On

Gil Barbara gilbarbara

💥
Keep Buggering On
View GitHub Profile
@matthisamoto
matthisamoto / doc-ready.js
Created June 27, 2012 15:53
My document.ready function of choice for jQuery
(function($) {
}(jQuery));
@barockok
barockok / bar-es6.js
Last active December 3, 2015 16:38 — forked from OliverJAsh/bar-es6.js
sandboxed-module error with transitive ES6 deps ( solve with babel )
export default 'bar';
@lucasbento
lucasbento / SomeInfinityLoadingSearch.js
Last active October 5, 2016 00:12
Easy infinity loading with React
class SomeInfinityLoadingSearch extends Component {
state = {
isLoading: false,
}
handleScroll = () => {
if (((window.innerHeight + window.scrollY) >= document.body.offsetHeight) && !this.state.isLoading) {
this.setState({
isLoading: true,
});
@nickydonna
nickydonna / ControllerRouter.js
Created September 22, 2016 19:53
A Contoller ReactRouter for v4
/* @flow */
import BrowserHistory from 'react-history/BrowserHistory'
import {Push, Replace} from 'react-history'
import React, {Component} from 'react'
import {StaticRouter} from 'react-router'
type RouterProps = {
onChange: (action: string, location: Object) => void,
pathname: string,
navigation?: 'PUSH' | 'REPLACE',
@sibelius
sibelius / Codemod RN24 to RN25.md
Last active November 9, 2016 13:09
Codemod React Native 24 imports to RN25 imports

README

Why this transform is necessary?

Until React Native 24, you import React from 'react-native' package, but this will change on RN 25, you will need to import React from 'react'. You probably have many files that does this, so I've created a codemod to save you a bunch of time

How to use this

  • Install jscodeshif
@sibelius
sibelius / NetInfo.js
Last active August 20, 2017 20:13
Tiny component that shows an alert bar when there is no internet connection
import React, { Component } from 'react';
import {
View,
Text,
TouchableHighlight,
NetInfo,
} from 'react-native';
export default class ConnectionInfo extends Component {
state = {
@mikberg
mikberg / sauce.js
Created January 23, 2016 17:26
Report Nightwatch results to SauceLabs
/* eslint no-console:0 */
const https = require('https');
module.exports = function sauce(callback) {
const currentTest = this.client.currentTest;
const username = this.client.options.username;
const sessionId = this.client.capabilities['webdriver.remote.sessionid'];
const accessKey = this.client.options.accessKey;
if (!this.client.launch_url.match(/saucelabs/)) {
@mxriverlynn
mxriverlynn / 0.js
Last active September 10, 2018 08:33
recursing a tree structure with ES6 generators
function *doStuff(){
yield 1;
yield 2;
yield *doStuff();
}
var it = doStuff();
var res;
res = it.next();
/*eslint no-console: 0*/
import React, { PropTypes } from 'react'
import { historyContext as historyContextType } from 'react-history/PropTypes'
import StaticRouter from './StaticRouter'
// intitial key is `null` because JSON.stringify turns undefined into null, and
// we use this value as the "initial key"
const initialKeys = [ null ]
const IS_DOM = typeof window !== 'undefined'
@akuzemchak
akuzemchak / Side Bar.sublime-menu
Created August 13, 2011 15:35
Reveal folder in Finder for Sublime Text 2
# add this to the main command array...
{ "caption": "Open Containing Folder…", "command": "open_this_folder", "args": {"dirs": []} }