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
function leastDistance(input) { | |
const rowDim = input[0].length | |
const colDim = input.length | |
const isValidInput = !input.find(r => r.length !== rowDim) | |
// Track all positions for 1 and 2s; | |
// the 1 will be the first element | |
const positions = [] | |
input.forEach((row, i) => { | |
Array.from(row).forEach((s, j) => { |
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
#!/bin/bash | |
# | |
# Requires: | |
# - gdal_sieve.py | |
# - ogr2ogr (GDAL) | |
# - topojson (node.js) | |
# Grab the relative directory for source file. | |
SRC_DIR=`dirname $0` |
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 main | |
import ( | |
"cloud.google.com/go/bigquery" | |
"context" | |
"fmt" | |
"google.golang.org/api/iterator" | |
"log" | |
"math/rand" | |
"os" |
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
mux := http.NewServeMux() | |
mux.HandleFunc("/projects/", project.Project(session)) | |
func Project(session *mgo.Session) func(w http.ResponseWriter, req *http.Request) { | |
return func(w http.ResponseWriter, req *http.Request) { | |
middleware.DebugLogger.Println("Inside project controller") | |
switch req.Method { |
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
SELECT |
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
// AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt | |
// ---------------------------------------------------------------------------------------- | |
// the encrypted datablock is base64 encoded for easy data exchange. | |
// if you have the option to store data binary save consider to remove the encoding to reduce storage size | |
// ---------------------------------------------------------------------------------------- | |
// format of encrypted data - used by this example. not an official format | |
// | |
// +--------------------+-----------------------+----------------+----------------+ | |
// | SALT | Initialization Vector | Auth Tag | Payload | | |
// | Used to derive key | AES GCM XOR Init | Data Integrity | Encrypted Data | |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Set up a new password for {{ product_name }}</title> | |
<!-- | |
The style block is collapsed on page load to save you some scrolling. | |
Postmark automatically inlines all CSS properties for maximum email client | |
compatibility. You can just update styles here, and Postmark does the rest. |
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 React, { Component } from 'react'; | |
import Sidebar from '../Sidebar/Sidebar'; | |
import GoogleMap from '../GoogleMaps/GoogleMap'; | |
class App extends Component { | |
render() { | |
return ( | |
<div> | |
<Sidebar /> |
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
#include <CameraC328R.h> | |
#include <SoftwareSerial.h> | |
#define LED_PIN 13 | |
#define PAGE_SIZE 64 | |
#define USB_BAUD 115200 | |
#define CAMERA_BAUD 115200 | |
SoftwareSerial mySerial(2, 3); | |
CameraC328R camera(&mySerial); | |
uint16_t pictureSizeCount = 0; |
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 React from 'react'; | |
import Scroll from 'react-scroll'; | |
export default class Component extends React.Component { | |
state = {showNew: false}; | |
save = (step, card) => { | |
let update = {step, type: 'SET_CHECKOUT'}; | |
if (card) { | |
update.payment = card; |
NewerOlder