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
# Instead of loading all of Rails, load the | |
# particular Rails dependencies we need | |
require 'sqlite3' | |
require 'active_record' | |
require 'pry' | |
# Set up a database that resides in RAM | |
ActiveRecord::Base.establish_connection( | |
adapter: 'sqlite3', | |
database: ':memory:' |
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
function onOpen() { | |
var ui = SpreadsheetApp.getUi(); | |
// Or DocumentApp or FormApp. | |
ui.createMenu('XYZ Menu') | |
.addItem('Generate PO', 'createDcument') | |
.addToUi(); | |
} | |
function createDcument() { | |
var activeSheet = SpreadsheetApp.getActiveSpreadsheet(); |
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
From 98e66e960491f10d543686211b30c3c6a8d61192 Mon Sep 17 00:00:00 2001 | |
From: ydarbleoj <[email protected]> | |
Date: Tue, 16 Oct 2018 15:11:17 -0700 | |
Subject: [PATCH 1/4] Added event model and migration | |
--- | |
app/models/event.rb | 3 +++ | |
db/migrate/20181016215050_create_events.rb | 11 +++++++++++ | |
db/schema.rb | 10 +++++++++- | |
test/fixtures/events.yml | 13 +++++++++++++ |
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
From 43bbfa63f3efa6b10abcd7454d2953cb37b9efc9 Mon Sep 17 00:00:00 2001 | |
From: Raghu <[email protected]> | |
Date: Mon, 15 Oct 2018 15:34:18 -0700 | |
Subject: [PATCH 1/2] Code challenge | |
--- | |
vue-spa/src/App.vue | 14 ++++++++++++-- | |
vue-spa/src/components/TrackableEvent.vue | 17 +++++++++++++++++ | |
2 files changed, 29 insertions(+), 2 deletions(-) | |
create mode 100644 vue-spa/src/components/TrackableEvent.vue |
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
diff --git a/app/models/provider.rb b/app/models/provider.rb | |
index c468731..d4afb3a 100644 | |
--- a/app/models/provider.rb | |
+++ b/app/models/provider.rb | |
@@ -1,3 +1,4 @@ | |
class Provider < ApplicationRecord | |
has_many :customers, as: :company | |
+ has_many :tracking_events | |
end | |
diff --git a/app/models/shipper.rb b/app/models/shipper.rb |
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 java.util.Arrays; | |
public class SyncExample { | |
public static void main(String[] args) { | |
try { | |
TicketingSystem ts = new TicketingSystem(); | |
TicketCounter tc1 = new TicketCounter(ts, "Thread 1"); | |
TicketCounter tc2 = new TicketCounter(ts, "Thread 2"); | |
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
class Ticket { | |
private String name; | |
private String status; | |
public Ticket(String name, String status) { | |
this.name = name; | |
this.status = status; | |
} | |
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
class TicketingSystem { | |
static final Ticket number1 = new Ticket("Number1", "open"); | |
static final Ticket number2 = new Ticket("Number2", "open"); | |
static Ticket[] numberList = new Ticket[] {number1, number2}; | |
public static synchronized String getNextAvailableTicket() { | |
String availableNumber = null; | |
try { |
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
public static String getNextAvailableTicket() { | |
String availableNumber = null; | |
try { | |
synchronized(TicketingSystem.class){ | |
for (Ticket number: numberList) { | |
if(number.getStatus() == "open") { | |
number.setStatus("pending"); // changing the state of the object | |
System.out.printf("Thread name %s - number found %s \n",Thread.currentThread().getName(), number.getName()); |
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
class TicketCounter extends Thread { | |
TicketingSystem ticketingSystem; | |
public TicketCounter(String name) { | |
this.setName(name); | |
start(); | |
} | |
@Override | |
public void run() { |
OlderNewer