Skip to content

Instantly share code, notes, and snippets.

/**
* @file
* A JavaScript file for the theme.
*
* In order for this JavaScript to be loaded on pages, see the instructions in
* the README.txt next to this file.
*/
// JavaScript should be made compatible with libraries other than jQuery by
// wrapping it with an "anonymous closure". See:
@chadsten
chadsten / 0_reuse_code.js
Created February 26, 2014 15:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
// 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 {
#!/bin/bash
bashSource="data/file.txt"
if [ -e $bashSource ]; then
echo $bashSource "File exists!"
else
echo $bashSource "File does not exist!"
fi
<script>
$("tbody tr").click(function() {
if ($(this).parents().hasClass('selected')) {
$(this).appendTo($('.original'));
} else {
$(this).appendTo($('.selected'));
}
calculate();
})
@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'));
<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 / 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">
<?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;
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