Skip to content

Instantly share code, notes, and snippets.

View seve's full-sized avatar

Severiano Badajoz seve

View GitHub Profile
@seve
seve / trie.py
Last active February 22, 2019 00:45
class MyTrie(dict):
def __init__(self, word_list=None):
super(MyTrie, self).__init__()
self.id = 0
# the charcter, a unique id, end charcter in a word
self.root = ('', self.id, False)
self[self.root] = []
self.id += 1
def add_word(self, word):
# print('INSERTING WORD', word)
# Set current node to the root node
curr_node = self.root
# Iterate over the letters in the word
for i, letter in enumerate(word):
found_letter = False
# Look at all the children of the currrent node
for j, node in enumerate(self[curr_node]):
# If the node's letter and the current letter are the same

Keybase proof

I hereby claim:

  • I am seve on github.
  • I am severiano (https://keybase.io/severiano) on keybase.
  • I have a public key whose fingerprint is 650D A0D4 5AB9 CF15 2038 53AC 30A1 CD8F 46EE E4DD

To claim this, I am signing this object:

[
{
"key": "cmd+n",
"command": "-workbench.action.files.newUntitledFile"
},
{
"key": "cmd+n",
"command": "explorer.newFile"
},
{

Remove any existing database Ask GitHub for the stargazers of the GitHub repo 'iruka-dev/iruka' loop over the data Get a user's data from GitHub If the user has a organization Format the organization name Create a user database entry Iterate over the user's repos from GitHub Get the repo's languages from GitHub Iterate over the repo's issues from GitHub

Remove any existing database
Ask GitHub for the stargazers of the GitHub repo 'iruka-dev/iruka'
loop over the data
  Get a GitHub user's data from GitHub
    If the user has a GitHub organization
      Format the GithHub organization name
      Create a user database entry
      Iterate over the user's GitHub repos from GitHub
 Get the repo's languages from GitHub
@seve
seve / uglyCode.js
Created May 9, 2019 07:18
Code that needs refactoring
// POST: Update all of the users in the database
router.post('/', (req, res) => {
// Remove existing data
mongoose.connection.db.dropDatabase();
// Get request for all stargazers of Ikura repo
const getStargazers = octokit.activity.listStargazersForRepo.endpoint.merge({
owner: 'iruka-dev',
repo: 'iruka',
});
query {
viewer {
repositories(last:5){
nodes{
name
}
}
}
}
{
"data": {
"viewer": {
"repositories": {
"nodes": [
{
"name": "visual-trie"
},
{
"name": "streamer-analytics"
{
repository(owner: "iruka-dev", name: "iruka") {
stargazers(first: 50) {
nodes {
login
company
repositories(last: 10) {
nodes {
name
languages(first: 3) {