Skip to content

Instantly share code, notes, and snippets.

View chadsten's full-sized avatar
💭
Facepalming at my own terrible code since 2005

Chadsten chadsten

💭
Facepalming at my own terrible code since 2005
  • Colorado
View GitHub Profile
@chadsten
chadsten / test.py
Last active September 26, 2023 18:17 — forked from BazingaThat/aocday1.py
AOC Day1
f = open("AOCDay1.txt", "r")
with open('AOCDay1.txt') as f:
elf_calories = [line.rstrip('\n') for line in f]
elves = []
i = 0
# we have to create the array element before we can add to it
elves.insert(i, '')
for elf in elf_calories:
with open("Day1_input.txt", "r") as f:
modules = [int(x) for x in f.readlines()]
#part 1
fuel = sum((y // 3 - 2) for y in modules)
print(fuel)
#3390596
#holyshit
#part 2
with open("Day1_input.txt", "r") as f:
modules = [int(x) for x in f.readlines()]
#part 1
fuel = sum((y // 3 - 2) for y in modules)
print(fuel)
#3390596
#holyshit
#part 2
<?php
function tag_sidebar(){
$taxonomy = 'product_cat';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';
$empty = 0;
@chadsten
chadsten / html
Created February 7, 2018 00:51 — forked from anonymous/html
<div class="about-container">
<div>
<img src="//cdn.shopify.com/s/files/1/2933/2634/files/Kennys_Outside-01_2048x2048.png?v=1517860975" alt="" />
</div>
<div class="about-block">
<p class="about-text">
<html>
<head>
<title>Pad MP Calc</title>
<script type="text/javascript">
function go() {
var qparam = [];
if(this.no10mp.checked) { qparam.push("no10mp=True"); }
if(this.no1mp.checked) { qparam.push("no1mp=True"); }
if(this.no5mp.checked) { qparam.push("no5mp=True"); }
if(this.noonteam.checked) { qparam.push("noonteam=True"); }
@chadsten
chadsten / stuff.js
Last active May 23, 2016 00:27 — forked from anonymous/stuff.js
<script>
$(".original tbody").on( "click", "tr", function() {
var row_id = ($(this).attr('class').split(' ')[0]);
if ($('.selected .' + row_id).length > 0) {
// do nothing, probably should use .not() up there
} else {
$(this).addClass('cloned').clone().prependTo($('.selected'));
<script>
$("tbody tr").click(function() {
if ($(this).parents().hasClass('selected')) {
$(this).appendTo($('.original'));
} else {
$(this).appendTo($('.selected'));
}
calculate();
})
#!/bin/bash
bashSource="data/file.txt"
if [ -e $bashSource ]; then
echo $bashSource "File exists!"
else
echo $bashSource "File does not exist!"
fi
// If component already has a slice
if(componentArray[i].hasOwnProperty('slice')){
// Fade out current slice
componentArray[i].slice.fadeOut(200,function(){
// Swipe slice source
this.src = '/sites/default/files/generated_image/' + view + '_' + component_id + '-' + swatch_id + '.png';
// Fade back in
jQuery(this).fadeIn(200);
});
} else {