Skip to content

Instantly share code, notes, and snippets.

View giacaglia's full-sized avatar
💻
Coding!

Giuliano Pezzolo Giacaglia giacaglia

💻
Coding!
View GitHub Profile
Download the React DevTools for a better development experience: https://fb.me/react-devtools
vendor.js:1Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `home`. See https://fb.me/react-warning-keys for more information.t.production.t.env.NODE_ENV.r @ vendor.js:1
vendor.js:1Warning: A component is `contentEditable` and contains `children` managed by React. It is now your responsibility to guarantee that none of those nodes are unexpectedly modified or duplicated. This is probably not intentional.t.production.t.env.NODE_ENV.r @ vendor.js:1
vendor.js:1Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or
@giacaglia
giacaglia / keybase.md
Last active September 11, 2016 23:31

Keybase proof

I hereby claim:

  • I am giacaglia on github.
  • I am giu (https://keybase.io/giu) on keybase.
  • I have a public key ASCZ1vaPZIcQ-2vYrXSLxk2EF_t-m7ob8EvS-8wJHdB2ygo

To claim this, I am signing this object:

@giacaglia
giacaglia / DYLD_PRINT_STATISTICS
Last active September 29, 2016 15:46
DYLD_PRINT_STATISTICS output example
total time: 2.4 seconds (100.0%)
total images loaded: 353 (303 from dyld shared cache)
total images loading time: 1.4 seconds (58.5%)
total dtrace DOF registration time: 0.17 milliseconds (0.0%)
total rebase fixups: 165,102
total rebase fixups time: 31.64 milliseconds (1.3%)
total binding fixups: 388,733
total binding fixups time: 288.71 milliseconds (11.9%)
total weak binding fixups time: 1.79 milliseconds (0.0%)
total bindings lazily fixed up: 0 of 0
- (nonnull NSString *)camelCaseToSnakeCaseString
{
if ([self length] == 0) {
return @"";
}
NSMutableString *output = [NSMutableString string];
NSCharacterSet *digitSet = [NSCharacterSet decimalDigitCharacterSet];
NSCharacterSet *uppercaseSet = [NSCharacterSet uppercaseLetterCharacterSet];
- (nonnull NSString *)camelCaseToSnakeCaseString
{
if ([self length] == 0) {
return @"";
}
NSError *error = nil;
// this regex finds the boundaries between lowercase/uppercase/digits and lets the string be split accordingly.
NSString *lowercaseToUppercaseBoundary = @"(?<=[a-z])(?=[A-Z])";
NSString *lowercaseToDigitBoundary = @"(?<=[a-z])(?=[0-9])";
total time: 2.6 seconds (100.0%)
total images loaded: 328 (303 from dyld shared cache)
total images loading time: 1.2 seconds (45.9%)
total dtrace DOF registration time: 0.17 milliseconds (0.0%)
total rebase fixups: 394,129
total rebase fixups time: 87.76 milliseconds (3.2%)
total binding fixups: 399,592
total binding fixups time: 300.46 milliseconds (11.2%)
total weak binding fixups time: 6.58 milliseconds (0.2%)
total bindings lazily fixed up: 0 of 0
Language files blank comment code
-------------------------------------------------------------------------------
Objective C 1089 31528 14773 132248
Swift 864 19360 8987 75756

UIColors

.blueColor() to UIColor.blue

.clearColor() to UIColor.clear

.darkGrayColor() to UIColor.darkGray

.lightGrayColor() to UIColor.lightGray

find . -type f -name '*.swift' -exec sed -i '' s/\.endIndex/\.upperBound/ {} +
find . -type f -name '*.swift' -exec sed -i '' s/\.startIndex/\.lowerBound/ {} +
find . -type f -name '*.swift' -exec sed -i '' s/offsetInPlace/offsetBy/ {} +
# Uppercase to lowercase
find . -type f -name '*.swift' -exec sed -i '' s/\.CGColor/\.cgColor/ {} +
@giacaglia
giacaglia / catalog_upload.py
Last active April 24, 2018 21:02
Dataflow Daily Upload
#1 Here we define the Dataflow pipeline
with beam.Pipeline() as p:
# 2 We query all products in the queried_namespace
query = query_pb2.Query()
query.kind.add().name = 'Product'
entities = p | 'Read From Datastore' >>
ReadFromDatastore('project_name', query, namespace='queried_namespace')
# 3 Formatting the rows
products = entities | 'Format Rows' >> beam.Map(transform_entity)