Skip to content

Instantly share code, notes, and snippets.

View giancarlosisasi's full-sized avatar
🔥
Making the web faster!

Giancarlos Isasi giancarlosisasi

🔥
Making the web faster!
View GitHub Profile
class Dropdown extends Component {
state = {
show: false
}
componentDidMount() {
document.addEventListener('click', this.handleClickOutside, true);
}
componentWillUnmount() {
sudo apt-get install unzip
wget -N http://chromedriver.storage.googleapis.com/2.10/chromedriver_linux64.zip -P ~/Downloads
unzip ~/Downloads/chromedriver_linux64.zip -d ~/Downloads
chmod +x ~/Downloads/chromedriver
sudo mv -f ~/Downloads/chromedriver /usr/local/share/chromedriver
Change the directory to /usr/bin/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
Now run the script and add the following in the environment file.
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
data: undefined,
};
}
componentWillMount() {
// Data
var object = { 'a': [{ 'b': { 'c': 3 } }] };
var object2 = {a: { b: { c: 3 } } };
// Function helper to get the type of Param
const getTypeOfParam = (value) => Object.prototype.toString.call(value).replace(/^\[object |\]$/g, '').toLowerCase();
const getIn = (obj, path, defaultValue) => {
// validate params
if (getTypeOfParam(obj) !== 'object') throw new TypeError('the first param should be a object');
if (getTypeOfParam(path) !== 'string') throw new TypeError('the second param should be a object');
// Menu styles
.menu {
@extend %flex-container;
box-shadow: 0px 2px 2px rgba(30, 30, 30, 0.42);
height: 72px;
top: 0;
font-family: $font-family--primary;
position: fixed;
width: 100vw;
z-index: 900;
(function() {
"use strict";
angular.module('app')
.controller('GeneralCtrl', GeneralCtrl);
GeneralCtrl.$inject = ['$timeout', 'EnterpriseService', 'TouchPointService'];
function GeneralCtrl($timeout, EnterpriseService, TouchPointService) {
var vm = this;
vm.test = 'test general trip';
// GET USER DATA
(function() {
"use strict";
angular.module('app')
.factory('GetUserService', GetUserService);
GetUserService.$inject = ['$http', '$log', '$q', 'localStorageService'];
function GetUserService($http, $log, $q, localStorageService) {
(function() {
'use strict';
angular.module('app', ['LocalStorageModule',
'cleave.js',
'ngAnimate',
'ngRoute',
'ui.router',
'templates'])
.config(['$stateProvider', '$authProvider', '$urlRouterProvider', '$locationProvider', function ($stateProvider, $authProvider, $urlRouterProvider, $locationProvider) {
$stateProvider
// children component
class Children extends Component {
state = {
text: "text children"
}
changeText = () => {
this.setState({ text: "text from parent" })
};
import React from 'react';
export default class App extends React.Component {
state: {
searchText: '',
data: [{id: 1, text: 'text 1'}, {id: 2, text: 'text 2'}]
}
renderFilteredData = () => {
const { searchText, data } = this.state