Skip to content

Instantly share code, notes, and snippets.

Chase Lambert theicfire

Block or report user

Report or block theicfire

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 sqrt.py
# Find sqrt(2)
# Get a graph of y^2 - 2, find the 0. Use newtons's method.
import math
def iterate_root(start, n, p):
dx = .01
dy = ((start + dx) ** p) - (start ** p)
return start - ((start**p) - n)/(dy/dx)
def get_sqrt(n):
View finddup.py
# Q: Given a list of length n+1 with numbers from 1 to n, there will be at least one duplicate. Find it.
# Running time: O(n). Space: O(1). Or rigorously O(lgn) given that a constant variable to represent the number "n" grows with lgn.
# http://stackoverflow.com/questions/6420467/find-any-one-of-multiple-possible-repeated-integers-in-a-list/6420503#6420503
import random
import pytest
def find_dup(lst):
assert(len(lst) >= 2)
assert(all(map(lambda x: 0 < x < len(lst), lst)))
#find cycle
View makefile
# Makefile tutorial, through examples
# This is not a makefile! I just called it as such to have vim coloring work well.
########
# This makefile will always run. The default target is some_binary, because it is first.
########
some_binary:
echo "nothing"
########
View designer.html
<link rel="import" href="../code-mirror/code-mirror.html">
<link rel="import" href="../speech-mic/speech-mic.html">
<link rel="import" href="../yt-video/yt-search-video.html">
<link rel="import" href="../cool-clock/cool-clock.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
<polymer-element name="my-element">
<template>
<style>
@theicfire
theicfire / gist:8535877
Created Jan 21, 2014
Hide Old Rows for Google Docs using Apps Script
View gist:8535877
/**
* Looks for rows with old dates, and hides them if so.
* It finds the date column my checking the first column for the word 'Date'.
*/
function hideOldRows(colNum) {
var sheet = SpreadsheetApp.getActiveSheet();
var header = sheet.getRange(1, 1, 1, sheet.getLastColumn());
var colNum = header.getValues()[0].indexOf('Date') + 1;
if (colNum === 0) {
Logger.log(header.getValues());
@theicfire
theicfire / gist:6573314
Last active Dec 23, 2015
Resizable line with handles | SVG, d3.js, Javascript
View gist:6573314
<!DOCTYPE html>
<meta charset="utf-8">
<style>
svg {
float: left;
}
line {
shape-rendering: crispEdges;
stroke-width: 1px;
@theicfire
theicfire / new_bashrc.sh
Created Aug 11, 2012 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful.
View new_bashrc.sh
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
# Are you tired of trying to remember how darwin/mac-osx treat them differently from linux?
# Are you tired of not having your ~/.bash* stuff work the way you expect?
#
# Symlink all of the following to this file:
# * ~/.bashrc
You can’t perform that action at this time.