Skip to content

Instantly share code, notes, and snippets.

View piontekle's full-sized avatar

Lauren Piontek piontekle

View GitHub Profile
> sharp@0.20.8 install /Users/Lauren/Documents/GitHub/pdf-generator/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Using cached /Users/Lauren/.npm/_libvips/libvips-8.6.1-darwin-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=12.18.3 runtime=node arch=x64 platform=darwin)
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:27:
../src/common.h:82:20: error: no member named 'Handle' in namespace 'v8'
bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
@piontekle
piontekle / calculator.py
Created August 6, 2020 14:55
Basic calculator built in Python3
import re
print("Welcome to The Calculator")
print("Type 'quit' to exit\n")
previous = 0
run = True
def perform_math():
global run
//Is Unique: Implement an algorithm to determine if a string
//has all unique characters. What if you cannot use additional
//data structures?
function isUnique(str) {
//Assuming capital letter is unique from its lower case
//Will there be spaces?/Do spaces count as characters?
//would be easy to use a Map & iterate through: O(n)
//No add'l data structures: Sort & loop through O(n + logn)
if (str.length <= 1) return true;
//Searching
const sortedLgArr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39];
// Linear - O(n)
function linearSearch(arr, val) {
for (let i = 0; i < arr.length; i++) {
if (arr[i] === val) return arr[i];
}
return "Not found.";
}
@piontekle
piontekle / sortingAlgos.js
Created July 6, 2020 22:01
Sorting Algorithm Practice - July 2020
const smArr = [8, 3, 5, 1, 4, 2];
const sortedSmArr = [1, 2, 3, 4, 5, 8];
//source: https://stackoverflow.com/questions/5836833/create-an-array-with-random-values
for (var lgArr=[],i=0;i<40;++i) lgArr[i]=i;
function shuffle(array) {
var tmp, current, top = array.length;
if(top) while(--top) {
current = Math.floor(Math.random() * (top + 1));
=begin
Given an array, find the int that appears an odd number of times.
There will always be only one integer that appears an odd number of times.
967 ms
=end
def find_it(seq)
#your code here
counts = Hash.new(0)
handleSubmit(e) {
e.preventDefault();
const { url, name, email, subject, message } = this.state;
axios.post(`${url}/sendMail`, {
name,
email,
subject,
message
})
.then((res) => {
//Fizzbuzz
for (i=1; i<=100; i++) {
if (i%15 === 0) console.log ("FizzBuzz");
else if (i%3 === 0) console.log ("Fizz");
else if (i%5 === 0) console.log("Buzz");
else console.log(i);
}
//*********************************************************************************************
//Subarray Sum Equals K
//Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.
Unhandled rejection TypeError: Cannot read property 'wiki' of undefined
at wikiQueries.getWiki (/Users/piontekle/bloc/bloccipedia/src/controllers/wikiController.js:82:24)
at Collaborator.scope.findAll.then.catch (/Users/piontekle/bloc/bloccipedia/src/db/queries.wikis.js:31:11)
at tryCatcher (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/promise.js:690:18)
at _drainQueueStep (/Users/piontekle/bloc/bloccipedia/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/Users/piontekle/bloc/blocci
@piontekle
piontekle / gist:17eea090c981d281c7a1babb6609afcc
Last active March 14, 2019 21:21
Assignment 14 getPoints() undefined
Started
server is listening for requests on port 3000
.....VOTE:
Vote {
dataValues:
{ id: 1,
value: 1,
postId: 1,
userId: 1,
createdAt: 2019-03-14T21:20:25.302Z,