Skip to content

Instantly share code, notes, and snippets.

View StabbyMcDuck's full-sized avatar

Regina StabbyMcDuck

  • Minneapolis, MN
View GitHub Profile
{
"stash": [
{
"colorway_name": "",
"dye_lot": "",
"id": 8770756,
"comments_count": 0,
"updated_at": "2014\/01\/10 14:53:38 -0500",
"has_photo": false,
"created_at": "2013\/07\/20 15:40:03 -0400",
{
"yarn": {
"yarn_fibers": [
],
"min_gauge": null,
"max_needle_size": null,
"yardage": null,
"texture": "",
"rating_total": 130,
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "dynamicArray.h"
/* param: s the string
param: num a pointer to double
returns: true (1) if s is a number else 0 or false.
postcondition: if it is a number, num will hold
@StabbyMcDuck
StabbyMcDuck / gist:6b6da1942f0db7e5f6b9
Last active August 29, 2015 14:19
possible fix for subarray
typedef struct {
int left;
int right;
int sum;
} max_subarray;
max_subarray find_maximum_subarray(int A[], unsigned low, unsigned high) {
max_subarray suffixes[high - low];
suffixes[0].left = low;
public class CalcMaxSubArray {
double[] maxSubarray(double[] a) {
double max_so_far = 0;
double max_ending_here = 0;
int max_start_index = 0;
int startIndex = 0;
int max_end_index = -1;
for(int i = 0; i < a.length; i++) {
if(0 >= max_ending_here +a[i]) {
//
// reginaImhoff.cpp
// cs325project1
//
// Created by Regina Imhoff on 4/21/15.
//
//
#include "algorithm4.h"
#include <iostream>
6) Let f1 and f2 be asymptotically positive functions. Prove or disprove each of the following conjectures. To disprove give a counter example.
a. If f1(n) = O( g1(n)) and f2(n) = O( g2(n)) then f1(n)+f2(n) = O( g1(n)+g2(n) )
Let f1(n) = O(g1(n)) and f2(n) = O(g2(n))
This means that there must exist some constants c1 > 0 and c2 > 0 such
That f1(n) ≤ c1g1(n) and f2(n) ≤ c2g2(n) for all n > 0.
We will find some constant, c3 that causes f1(n)+f2(n) ≤ c3 [g1(n) + g2(n)] for all
n>0 integers:
f1(n) + f2(n)≤ c1g1(n) + c2g2(n)
≤ max(c1, c2)g1(n) + max(c1, c2)g2(n)
≤ max(c1, c2) [g1(n) + g2(n)]
@StabbyMcDuck
StabbyMcDuck / gist:97e2fbb6ed3653f3bcdb5396083023d6
Created September 29, 2016 17:14
recursive fibonacci in python
from time import time
fibs = {0: 0, 1: 1}
def fib(n):
if n in fibs: return fibs[n]
if n % 2 == 0:
fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)
return fibs[n]
else:
fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)
private func fetch(credentials: Credentials, inEntityNamed: String, url: String, _ completion: @escaping (NSError?) -> Void) {
//print("Authentication: '\(credentials.user)' '\(credentials.password)'")
Alamofire
.request(url)
.authenticate(user: credentials.user, password: credentials.password)
.responseData { response in
let statusCode = response.response?.statusCode
if 200 <= statusCode! && statusCode! <= 299 {
let jsonResult = Request.serializeResponseJSON(options: JSONSerialization.ReadingOptions.allowFragments, response: response.response, data: response.data, error: nil)
<% if current_user %>
<div id="add_some_crap">
<h3><%= link_to "Add Some Crap!", containers_path, class: "btn btn-success btn-lg" %></h3>
</div>
<% else %>
<h3 class="large-font-sign-in">
<%= link_to "Sign in with Facebook",
"/auth/facebook", id: "facebook_sign_in",
class: "btn btn-primary btn-lg" %></h3>