This file contains 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
#Singleton class for interview practice | |
require 'singleton' | |
class InterviewSingleton | |
include Singleton | |
def iterate | |
@iterator ? @iterator += 1 : @iterator = 0 | |
end |
This file contains 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 Array | |
def first_index(x) | |
key = x | |
f = 0 | |
b = self.size | |
mid = get_mid(f,b) | |
until f == (b - 1) || f == b | |
self[mid] < key ? f = mid : b = mid |
This file contains 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 json | |
from algoliasearch import algoliasearch | |
APP_ID = 'MY_APP_ID' | |
API_ETL_KEY = 'API_KEY_WITH_BROWSE_AND_WRITE_ACCESS' | |
BROWSE_INDEX_NAME = 'MY_SHOPIFY_INDEX_NAME' | |
WRITE_INDEX_NAME = 'MY_NEW_SHOPIFY_INDEX_NAME' | |
BATCH_SIZE = 10 | |
LOCALE = 'en_CA' |
This file contains 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 linkedlistsingle | |
import "fmt" | |
type node struct { | |
Next *node | |
Value int | |
} | |
//LinkedList is a data structure for storing data in nodes with references to each other |