Skip to content

Instantly share code, notes, and snippets.

View laguiar's full-sized avatar
🏠
Working from home

Luiz Aguiar laguiar

🏠
Working from home
View GitHub Profile
@laguiar
laguiar / defensive-portfolio.csv
Last active February 22, 2020 23:43
Investment Portfolio - Trading212 free share invitation www.trading212.com/invite/FMABQ4xy
Ticker Company Dividend Yield
AAPL Apple Inc. 0.98
ADP Automatic Data Processing. Inc. 2.08
BA Boeing Company (The) 2.48
BAC Bank of America Corporation 2.07
CAT Caterpillar. Inc. 2.79
CL Colgate-Palmolive Company 2.43
CSCO Cisco Systems. Inc. 2.85
CVX Chevron Corporation 4.07
D Dominion Energy. Inc. 4.39
@laguiar
laguiar / reactor.kt
Last active July 25, 2019 21:40
Just a quick example with reactor
Flux.error<String>(RuntimeException())
.retryWhen { error ->
error.doOnNext { println(it) }
.zipWith(Flux.range(1, 4))
.map { tuple -> if (tuple.t2 < 4) tuple.t2 else throw Exceptions.propagate(tuple.t1) }
.flatMap { Mono.delay(Duration.ofMillis(it.toLong() * 1000)) }
.doOnNext { println("Retrying... ${LocalTime.now()}") }
}
.doOnError { println("Finished with ERROR!") }
.subscribe()
@laguiar
laguiar / berlin-burgers.csv
Last active June 21, 2022 13:27
List of the best burgers in Berlin
Name Rating Comment
Zsa Zsa Burger 8.5 the best so far
Windburger 7 Charlottenburg
Tommi's Burger 7 need a retest
Hard Rock Cafe 7 prepare your wallet (sometimes it's a bit dry)
Burgermeister 6.8 very honest buger but can be better... they are close to be the best
Corroboree Sony Center 6.8 extra cheeeeeeeeeeese!!!
Club Burger 6.8 Torstraße... cheap place but the burger was very nice
Revolver Burger 6.7 need a retest
Five Guys 6.7 a hipster pricey version of Burger King
-- From the Evan Miller's article http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
SELECT widget_id, ((positive + 1.9208) / (positive + negative) -
1.96 * SQRT((positive * negative) / (positive + negative) + 0.9604) /
(positive + negative)) / (1 + 3.8416 / (positive + negative))
AS ci_lower_bound
FROM widgets
WHERE positive + negative > 0
ORDER BY ci_lower_bound DESC;
@laguiar
laguiar / gist:2635776
Created May 8, 2012 14:45
Create UIColor from RGB code
#define PercentColor(a) (float)((float)a / 255.0f)
#define UIColorFromRGB(r, g, b, a) [UIColor colorWithRed:PercentColor(r) green:PercentColor(g) blue:PercentColor(b) alpha:PercentColor(a)*255.0f]
@laguiar
laguiar / mergexcode.sh
Created February 3, 2012 13:06
Merge the Xcode project.pbxproj
#!/bin/sh
projectfile=`find -d . -name 'project.pbxproj'`
projectdir=`echo *.xcodeproj`
projectfile="${projectdir}/project.pbxproj"
tempfile="${projectdir}/project.pbxproj.out"
savefile="${projectdir}/project.pbxproj.mergesave"
cat $projectfile | grep -v "<<<<<<< HEAD" | grep -v "=======" | grep -v "^>>>>>>> " > $tempfile
cp $projectfile $savefile
@laguiar
laguiar / ShareKitCustomEntries.txt
Created August 30, 2011 18:05
How to customize the ShareKit popover entries and remove the "More..." button.
- ShareKit -> Core -> SHK.m
Change in favoriteSharersForType method the NSArray favoriteSharers content:
Ex: favoriteSharers = [NSArray arrayWithObjects:@"SHKTwitter",@"SHKFacebook",@"SHKMail",nil];
- ShareKit -> UI -> SHKActionSheet.m
Remove in actionSheetForType method:
[as addButtonWithTitle:SHKLocalizedString(@"More...")];
Remove in dismissWithClickedButtonIndex method the entire "else if" block:
else if (buttonIndex == sharers.count)
//
// VerticallyAlignedLabel.h
//
#import <Foundation/Foundation.h>
typedef enum VerticalAlignment {
VerticalAlignmentTop,
VerticalAlignmentMiddle,
@laguiar
laguiar / gist:1120359
Created August 2, 2011 14:59
Align the UILabel content on top
UILabel *label;
CGRect labelRect = [label textRectForBounds:label.bounds limitedToNumberOfLines:10];
CGRect f = label.frame;
f.size.height = labelRect.size.height;
label.frame = f;
@laguiar
laguiar / Railscasts.xccolortheme
Created January 14, 2011 18:49
Railscasts theme for XCode
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Colors</key>
<dict>
<key>Background</key>
<string>0.082 0.087 0.109</string>
<key>InsertionPoint</key>
<string>1.000 1.000 1.000</string>