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
#!/usr/bin/env python | |
import subprocess | |
import os | |
import tarfile | |
import shutil | |
import glob | |
from datetime import datetime | |
import argparse |
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
try: | |
from line_profiler import LineProfiler | |
def do_profile(follow=[]): | |
def inner(func): | |
def profiled_func(*args, **kwargs): | |
try: | |
profiler = LineProfiler() | |
profiler.add_function(func) | |
for f in follow: | |
profiler.add_function(f) |
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
Exercise to hire new front-end in the future | |
You have a list of string (var regions = ['Brazil', 'SP', 'São Carlos', 'Caaso'] | |
Each one of these strings represents a region, the first region is the parent (includes) the second region, and so on. | |
You have the following POST route /region, that accepts name and parentId, and return the ID of the region created | |
Write a program in **JS** that saves all the regions taking into consideration their hierarchy: | |
Example of algorithm: | |
Save Brasil |
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
// find and update all import React, { Component } from 'react-native' | |
root | |
.find(j.ImportDeclaration, { | |
source: { | |
value: 'react-native' | |
} | |
}) | |
.filter(({node}) => { | |
// check React or { Component } from 'react-native' | |
const nodes = node.specifiers.filter(imports => { |
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
//Immediately Invoked Function Expression (IIFE) | |
(function() { | |
'use strict'; | |
angular | |
.module('app') | |
.directive('datepickerMask', datepickerMask); | |
function datepickerMask() { | |
var directive = { |
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
hostname |
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
Show hidden characters
{ | |
"presets": ["es2015", "stage-0"] | |
} |
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
@interface Person : NSObject <RCTBridgeModule> | |
@end | |
@implementation Logger | |
RCT_EXPORT_MODULE() | |
RCT_EXPORT_METHOD(greet:(NSString *)name) | |
{ | |
NSLog(@"Hi, %@!", name); |
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
export function prepareMongooseObject(obj) { | |
const placeholder = {}; | |
let counter = 0; | |
const objectIdToNumber = {}; | |
// TODO - find a better way to extract objects id | |
Object.keys(obj.toJSON()).map((key) => { | |
const value = obj[key]; |
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
/** | |
* Prepare an object to be snapshoted by jest | |
* replace objectID | |
* replace datetime | |
* frozen same specific keys | |
* @param obj | |
* @returns {{}} | |
*/ | |
export function prepareObject(obj, frozenKeys = []) { | |
const placeholder = {}; |
OlderNewer