Skip to content

Instantly share code, notes, and snippets.

View EmilGeorgiev's full-sized avatar

Emil Georgiev EmilGeorgiev

  • Veliko Tarnovo, Bulgaria
  • 12:34 (UTC +02:00)
View GitHub Profile
1. I’ve seen he used MongoDB, what was the reason? what does he think about this technology?
Basically, I’ve started working on a project that already had MongoDB and with
the time I really loved the technology. The features that I really liked are:
1.1. Sharding - is a method for distributing data across multiple servers.
MongoDB use the shard key which determines the distribution of the collection’s
documents among the cluster’s shards
1.2. Dynamic Schema - store documents without defining DB’s structure compared
// Oauth2Config is wrapper of oauth2.Config struct.
type Oauth2Config interface {
// AuthCodeURL returns a URL to OAuth 2.0 provider's consent page that asks for permissions
AuthCodeURL(state string) string
// Exchange converts an authorization code into a token.
Exchange(ctx context.Context, code string) (*oauth2.Token, error)
// RefreshToken refresh expired access token. It return new oauth2.Token or an error
interface OperatorRepository {
void registerOperator(Long roamingGroupId, RoamingGroup roamingGroup);
void removeOperator(Long operatorId);
}
class PersistentOperatorRepository implements OperatorRepository {
// Test need to set up roaming group ...
class Property {
private String name;
private String value;
}
interface Operator {
void changeProperties(List<Property> properties);
}
class MongoOperator implements Operator {
@EmilGeorgiev
EmilGeorgiev / Repositories - variant2
Created February 11, 2016 11:22
Here we solve problem with repositories as pass object from which our entity object depend (in our case Coupon depend from service) as parameter to method.
interface CouponRepository {
// requires service ...
void register(String service, String coupon);
}
interface ServiceRepository {
void register(String service);
void findService(String serviceId);
}
@EmilGeorgiev
EmilGeorgiev / Repositories varian-1
Created February 11, 2016 11:15
This is first gist with variant to solve with repositories problems with dependencies between collections in database.
interface RoaminGroupRepository {
void register(NewRoamingGroup newRoamingGroup);
void registerOperator(Long roamingGroupId, RoamingGroup roamingGroup);
void removeOperator(Long operatorId);
void addAccessPoint(Long operatorId, AccessPoint accessPoint);
void removeAccessPoint(Long accessPointId);
.navbar
.caret
.label
.table
.img-responsive
.img-rounded
.img-thumbnail
.img-circle
.sr-only
.lead
@EmilGeorgiev
EmilGeorgiev / dropdown menu
Created February 2, 2015 19:16
dropdown menu
<div class="dropdown">
<a class="dropdown-toggle" type="button" id="menu1" data-toggle="dropdown">
Tutorials
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="menu1">
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">HTML</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">CSS</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">JavaScript</a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">About Us</a></li>
''''javascript
describe("DHCP");
'''''
@EmilGeorgiev
EmilGeorgiev / SampleTest.java
Created June 10, 2014 13:40
Example with Provides
package com.clouway.alltest;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.name.Named;
import org.junit.Test;