Skip to content

Instantly share code, notes, and snippets.

Kory Becker primaryobjects

Block or report user

Report or block primaryobjects

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.css
.cell {
width: 50px;
height: 50px;
border: 1px solid black;
transition: background-color 0.25s;
}
.player {
font-size: 40px;
position: absolute;
@primaryobjects
primaryobjects / app.js
Last active Oct 18, 2019
Example 3x3 grid of clickable cells for game board, cells change color with alternating clicks to simulate player 1 and player 2 (isolation).
View app.js
$(function() {
ReactDOM.render(
<div>
<App></App>
</div>,
document.getElementById('root')
);
});
class Cell extends React.Component {
@primaryobjects
primaryobjects / selectLastCell.gs
Last active Oct 17, 2019
Automatically scroll to the last row in a Google Sheets spreadsheet upon opening the file. Google Docs. Google Drive.
View selectLastCell.gs
//
// Automatically scroll to the last row.
//
function selectLastRow() {
const sheets = SpreadsheetApp.getActive().getSheets();
// Set focus to the last active row on the first two sheets.
for (var sheetIndex = 0; sheetIndex < 2; sheetIndex++) {
// Get the sheet.
var sheet = sheets[sheetIndex];
@primaryobjects
primaryobjects / ghc-2019.md
Last active Oct 9, 2019
GHC19: Quantum Computing @ Grace Hopper Conference 2019
View ghc-2019.md

Quantum Computing @ Grace Hopper Conference 2019 GHC19

I had recently attended the Grace Hopper 2019 conference in Orlando, and had the opportunity to speak with researchers from IBMQ and Qiskit about the current state of quantum computing. Although, I did not get a chance to obtain a ticket to IBMQ's Universal Studios event at The Wizarding World of Harry Potter (the line was extremely long!), I still wanted to share some of the topics surrounding the emerging tech of quantum computing.

I spoke with Cihan Kurter, Research Scientist at IBM Watson, after her presentation titled, "Near-Term Applications of Quantum Computers", and asked, how exactly does the mysterious IBMQ qubit work?

IBMQ Quantum Computer

How does a qubit work?

@primaryobjects
primaryobjects / sync.md
Created Sep 25, 2019
How to synchronize a forked GitHub repository with the upstream repository.
View sync.md

How to synchronize a forked GitHub repository with the upstream repository

To sync a forked github repo with the upstream repository, use the following steps:

  1. Go to your forked repository on github.com.
  2. Click the Compare button.
  3. Change the base fork to your repository.
  4. Click Compare across forks.
  5. Change the head fork to the upstream repository.
@primaryobjects
primaryobjects / readme.md
Last active Aug 15, 2019
Counting valleys hiked, a programming exercise in C# .NET.
View readme.md

Gary is an avid hiker. He tracks his hikes meticulously, paying close attention to small details like topography. During his last hike he took exactly steps. For every step he took, he noted if it was an uphill, , or a downhill, step. Gary's hikes start and end at sea level and each step up or down represents a unit change in altitude. We define the following terms:

A mountain is a sequence of consecutive steps above sea level, starting with a step up from sea level and ending with a step down to sea level. A valley is a sequence of consecutive steps below sea level, starting with a step down from sea level and ending with a step up to sea level. Given Gary's sequence of up and down steps during his last hike, find and print the number of valleys he walked through.

For example, if Gary's path is DDUUUUDD, he first enters a valley 2 units deep. Then he climbs out an up onto a mountain 2 units high. Finally, he returns to sea level and ends his hike.

Function Description

@primaryobjects
primaryobjects / readme.md
Created Aug 14, 2019
How to preview an RST document in Sublime Text.
View readme.md

How to Preview an RST Document in Sublime Text

  1. In Sublime Text, click Preferences->Package Control.
  2. Type install and press Enter.
  3. Type OmniMarkupPreviewer and press Enter.
  4. After installing, open a .rst file (it must be a file already saved with a .rst file extension).
  5. In Sublime Text, use the hot-key CTRL-ALT-O or click Tools->Command Palette and type preview, selecting Preview Current Markup in Browser.

Your web browser should launch on localhost and display the formatted rst file.

@primaryobjects
primaryobjects / example.png
Last active Aug 14, 2019
Bootstrap table left-column minimum width and content column max width.
@primaryobjects
primaryobjects / background.js
Last active Jun 7, 2019
Chrome Extension example to trigger the permission update warning.
View background.js
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function(tab) {
// No tabs or host permissions needed!
console.log('Turning ' + tab.url + ' red!');
chrome.tabs.executeScript({
code: 'document.body.style.backgroundColor="red"'
@primaryobjects
primaryobjects / havelHakimi.R
Created May 30, 2019
[2019-05-20] Challenge #378 [Easy] The Havel-Hakimi algorithm for graph realization. Demo at https://repl.it/repls/OpulentExcitableInterfaces
View havelHakimi.R
havelHakimi <- function(data) {
result <- F
repeat {
# Remove all 0's.
data <- data[data != 0]
if (length(data) == 0) {
result <- T
break
}
You can’t perform that action at this time.