Skip to content

Instantly share code, notes, and snippets.

View javidjamae's full-sized avatar

Javid Jamae javidjamae

  • Postman
View GitHub Profile
Verifying my Blockstack ID is secured with the address 1JqirHH1XZHgu6BXnVmYu1jC9Bn5nq3UPz https://explorer.blockstack.org/address/1JqirHH1XZHgu6BXnVmYu1jC9Bn5nq3UPz
@javidjamae
javidjamae / README.md
Created October 7, 2017 05:05 — forked from matthieuprat/ README.md
Until operator for Enzyme's shallow wrapper

Usage

import until from 'path/to/until'
import { shallow } from 'enzyme'

const EnhancedFoo = compose(
  connect(...),
  withHandlers(...),
 withContext(...)
import {action1, action2} from "myActions";
import {bindActionCreators} from "redux";
const mapDispatchToProps(dispatch) => {
return {
manuallyBoundAction : (...args) => dispatch(action1(...args)),
autoBoundAction : bindActionCreators(action2, dispatch),
multipleActionsTogether : bindActionCreators({action1, action2}, dispatch)
}
};
@javidjamae
javidjamae / jest_textinput_mock.js
Created September 27, 2017 08:05
Mocking out a TextInput with jest
jest.mock( 'TextInput', () => {
const RealComponent = require.requireActual( 'TextInput' )
const React = require( 'React' )
class TextInput extends React.Component {
render() {
delete this.props.autoFocus
return React.createElement( 'TextInput', this.props, this.props.children )
}
}
TextInput.propTypes = RealComponent.propTypes
@javidjamae
javidjamae / lodashify.js
Created September 9, 2017 22:05 — forked from khalilovcmd/lodashify.js
to import lodash into chrome dev tools console
var el = document.createElement('script');
// el.src = "https://raw.githubusercontent.com/lodash/lodash/3.10.1/lodash.min.js";
// el.src = "https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.15.0/lodash.min.js";
el.src = "//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.15.0/lodash.min.js";
el.type = "text/javascript";
document.head.appendChild(el)
@javidjamae
javidjamae / App.js
Created August 21, 2017 17:20
React Native issue with TabNavigator and form autoFocus
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { TabNavigator } from 'react-navigation'
import TheListView from './TheListView'
import TheFormView from './TheFormView'
export default class App extends React.Component {
render() {
return (
<AppNavigator />
@javidjamae
javidjamae / selenium_using_sauce_labs.rb
Created April 5, 2016 23:21
Set up Selenium to use Sauce Labs without a gem
capabilities_config = {
:version => "43",
:browserName => "firefox",
:platform => "OS X 10.9",
:name => "Whatever name I want"
}
sauce_username = ENV['SAUCE_LABS_USERNAME']
sauce_api_key = ENV['SAUCE_LABS_API_KEY']
sauce_url = "http://#{sauce_username}:#{sauce_api_key}@ondemand.saucelabs.com:80/wd/hub".strip
@javidjamae
javidjamae / wait_while.rb
Last active March 31, 2016 18:42
Ruby: #wait_while
# Original source - https://coderwall.com/p/bkrg8a/ruby-wait_while
# Public: Wait while block returns false by repeatedly
# calling the block until it returns true.
#
# Useful to wait for external systems to do something.
# Like launching daemons in integration tests. Which
# you're not actually doing right? >_<
#
# timeout - Integer specifying how many seconds
# to wait for.
@javidjamae
javidjamae / pry.rb
Created January 4, 2016 21:33
How to configure pry to show the environment name in the prompt
# This file would go in config/initializers/pry.rb in a Rails project
old_prompt = Pry.config.prompt
env_str = "#{Rails.application.class.parent}-#{Rails.env}".upcase
if Rails.env.production?
# Can't do this because it messes with bash history for some reason
# env = Pry::Helpers::Text.red(env_str)
env = "\001\e[0;31m\002#{env_str}\001\e[0m\002"
else
# Can't do this because it messes with bash history for some reason
# env = Pry::Helpers::Text.green(env_str)
@javidjamae
javidjamae / javascript_dependency_injector.js
Last active October 2, 2015 00:32
Javascript Dependency Injector
(function() {
window.JDI = window.JDI || {};
/*
JDI.register - register a module on the "JDI" global
Usage:
with a namespace: JDI.register("foo", {bar: myFunc}) => JDI.foo.bar = myFunc
without a namespace: JDI.register({bar: myFunc}) => JDI.bar = myFunc
*/
JDI.register = function(){