Skip to content

Instantly share code, notes, and snippets.

View evonsdesigns's full-sized avatar
🌞

Joseph Evans evonsdesigns

🌞
View GitHub Profile
@evonsdesigns
evonsdesigns / test.json
Created April 19, 2018 19:54
fieldrates
{
"@type":"Job",
"notes":"Test Job for R2 Demo in TCI",
"cropYear":"2018",
"status":"COMPLETED",
"createdDate":"2018-04-02T08:59:44.957Z",
"startedDate":"2018-04-02T12:29:57.000Z",
"lastModifiedDate":"2018-04-02T12:30:55.000Z",
"type":"SEED",
"workPlan":{
@Entity
public class Person {
@OneToMany(targetEntity = com.data.Address.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private List<Address> addresses;
...
}
@Repository
public interface PersonRepository extends CrudRepository<Person, Long> {
@Query( value = "select * from person p " +
"join person_addresses b " +
" on p.id = b.person_id " +
"join address c " +
" on c.id = b.addresses_id " +
"where c.zip = :zip", nativeQuery = true)
Iterable<Person> getPeopleWithZip(@Param("zip") String zip);
@Repository
public interface PersonRepository extends CrudRepository<Person, Long> {
List<Person> findByAddressZipCode(String zipCode);
}
@Entity
public class ExamplePojo {
@Transient
private static final String type = "SomethingToInclude";
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
public void setId(Long id) {
@Bean
public ObjectMapper includeTransientObjectMapper() {
Hibernate5Module hibernate5Module = new Hibernate5Module();
hibernate5Module.disable(Hibernate5Module.Feature.USE_TRANSIENT_ANNOTATION);
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(hibernate5Module);
return mapper;
}

SQ is currently $68 and I own 100 shares. Say I will sell you the right to buy 100 SQ from me for $10. The deal is you buy 100 SQ at $70/share next Friday.

Outcomes:

SQ over 70 -> Buyer (you): You get to buy 100 SQ from me at $70. Wit a $10 premium, your effective price is $70.10 (if SQ is over that, you make the difference as gains$$) Seller (me): I sell 100 SQ @ 70, and keep the $10 premium.

SQ under 70 but above initial price -> Buyer: Call is worthless. (loses value initially paid) Seller: Keep premium and the 100 shares of SQ. (this is best outcome)

const timeout = ms => new Promise(res => setTimeout(res, ms))
function convinceMe (convince) {
let unixTime = new Date().getTime()
console.log(`Delay ${convince} at ${unixTime}`)
return unixTime
}
async function delay () {