This file contains hidden or 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
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "github.com/slack-go/slack" | |
| "golang.org/x/net/context" | |
| "golang.org/x/oauth2" | |
| "golang.org/x/oauth2/google" | |
| "google.golang.org/api/gmail/v1" |
This file contains hidden or 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
| func setSlackStatus() { | |
| api := slack.New(SlackAccessToken, slack.OptionDebug(false)) | |
| expirationTime := time.Now().Add(time.Hour * time.Duration(3)).Unix() | |
| err := api.SetUserCustomStatus("Gone Cycling", "🚴🏻♂️", expirationTime) | |
| if err != nil { | |
| log.Fatalf("Unable to set status : %v", err) | |
| } | |
| err = api.SetUserPresence("away") | |
| if err != nil { | |
| log.Fatalf("Unable to set presence : %v", err) |
This file contains hidden or 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
| func getLastMessageId(srv *gmail.Service) string { | |
| r, err := srv.Users.Messages.List(user).MaxResults(100).Q("to:[email protected] is:unread").Do() | |
| if err != nil { | |
| log.Fatalf("Unable to retrieve messages: %v", err) | |
| } | |
| if len(r.Messages) == 0 { | |
| fmt.Println("No messages found.") | |
| os.Exit(1) | |
| } | |
| return r.Messages[len(r.Messages)-1].Id |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "math/big" | |
| "runtime" | |
| "time" | |
| ) | |
| type computationRange struct { |
This file contains hidden or 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
| import 'dart:math'; | |
| void main() { | |
| var _emailSet = new Set.from([ | |
| '', | |
| '' | |
| ]); | |
| final _random = new Random(); |
This file contains hidden or 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
| // https://developers.slashdot.org/comments.pl?sid=33602&cid=3636102 | |
| public interface MessageStrategy { | |
| public void sendMessage(); | |
| } | |
| public abstract class AbstractStrategyFactory { | |
| public abstract MessageStrategy createStrategy(MessageBody mb); | |
| } | |
| public class MessageBody { |
This file contains hidden or 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
| setContentView(LithoView.create(this, | |
| ListItem.create(mComponentContext) | |
| .title("My Title") | |
| .subtitle("SubTitle") | |
| .listener(new View.OnClickListener() { | |
| @Override | |
| public void onClick(View view) { | |
| Toast.makeText(MainActivity.this, "Clicked", Toast.LENGTH_SHORT).show(); | |
| } | |
| }) |
This file contains hidden or 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
| @LayoutSpec | |
| class ListItemSpec { | |
| @OnCreateLayout | |
| static ComponentLayout onCreateLayout( | |
| ComponentContext c, | |
| @Prop(optional = true, resType = ResType.DIMEN_OFFSET) int shadowRadius, | |
| @Prop(optional = true) int color, | |
| @Prop String title, | |
| @Prop String subtitle) { |
This file contains hidden or 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
| setContentView(LithoView.create(this, | |
| ListItem.create(mComponentContext) | |
| .title("My Title") | |
| .subtitle("SubTitle") | |
| .build())); |
This file contains hidden or 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
| @LayoutSpec | |
| class ListItemSpec { | |
| @OnCreateLayout | |
| static ComponentLayout onCreateLayout( | |
| ComponentContext c, | |
| @Prop(optional = true, resType = ResType.DIMEN_OFFSET) int shadowRadius, | |
| @Prop(optional = true) int color, | |
| @Prop String title, | |
| @Prop String subtitle) { |