Skip to content

Instantly share code, notes, and snippets.

View CrowderSoup's full-sized avatar
🦄
[object Object]

Aaron Crowder CrowderSoup

🦄
[object Object]
View GitHub Profile
@CrowderSoup
CrowderSoup / script.rb
Created May 25, 2022 21:29
Disable discount codes for orders containing gift cards
class Campaign
def initialize(condition, *qualifiers)
@condition = (condition.to_s + '?').to_sym
@qualifiers = PostCartAmountQualifier ? [] : [] rescue qualifiers.compact
@line_item_selector = qualifiers.last unless @line_item_selector
qualifiers.compact.each do |qualifier|
is_multi_select = qualifier.instance_variable_get(:@conditions).is_a?(Array)
if is_multi_select
qualifier.instance_variable_get(:@conditions).each do |nested_q|
@post_amount_qualifier = nested_q if nested_q.is_a?(PostCartAmountQualifier)
@CrowderSoup
CrowderSoup / tasks.json
Last active April 14, 2017 21:29
VSCode Task for serving swagger docs with http://goswagger.io
{
"version": "0.1.0",
"command": "bash",
"isShellCommand": true,
"showOutput": "always",
"args": [
"-c"
],
"tasks": [{
"taskName": "swagger",
@CrowderSoup
CrowderSoup / gitkraken_crash.log
Created January 29, 2016 16:18
Crash log from GitKraken
PID 13880 received SIGSEGV for address: 0xf00ba1c8
SymInit: Symbol-SearchPath: '.;C:\Users\acrowder\AppData\Local\gitkraken\app-0.6.0;C:\Users\acrowder\AppData\Local\gitkraken\app-0.6.0;C:\WINDOWS;C:\WINDOWS\system32;SRV*C:\websymbols*http://msdl.microsoft.com/download/symbols;', symOptions: 530, UserName: 'acrowder'
OS-Version: 10.0.10240 () 0x100-0x1
00007FFDDD28296B (segfault-handler): (filename not available): (function-name not available)
00007FFDDD281417 (segfault-handler): (filename not available): (function-name not available)
00007FFDF2C02347 (ntdll): (filename not available): RtlNormalizeString
00007FFDF2BB38FE (ntdll): (filename not available): RtlWalkFrameChain
00007FFDF2BB21C4 (ntdll): (filename not available): RtlRaiseException
00007FFDF00BA1C8 (KERNELBASE): (filename not available): RaiseException
00007FFDF05A9931 (RPCRT4): (filename not available): RpcRaiseException
@CrowderSoup
CrowderSoup / hourOfCode.js
Created December 9, 2015 07:29
Hour Of Code Star Wars Game
var game = function () {
setBackground("random");
setMap("random");
setDroid("R2-D2");
setDroidSpeed("normal");
playSound("R2-D2random");
var moved = false;
var points = 0;
@CrowderSoup
CrowderSoup / drowningbot.js
Created August 20, 2015 14:02
A bot to play "Drowning in Problems" for you. http://game.notch.net/drowning/
var interval = setInterval(function(){
var aTags = document.getElementsByTagName("a");
// Bail out if we didn't find any anchor tags.
if(aTags.length <= 0) {
return;
}
// Get the IDs of the tags we're going to click
var aTagIds = [];
@CrowderSoup
CrowderSoup / keybase.md
Last active August 29, 2015 14:16
keybase.md

Keybase proof

I hereby claim:

  • I am CrowderSoup on github.
  • I am crowdersoup (https://keybase.io/crowdersoup) on keybase.
  • I have a public key whose fingerprint is CF37 B14A 2FB4 F73B FFD5 8C01 680E C0CD 3F2D 62A0

To claim this, I am signing this object:

@CrowderSoup
CrowderSoup / imgresizr.py
Last active August 29, 2015 14:11
Just a quick example of how to resize an INCREDIBLY large image.
from PIL import Image
# 8 Inches
basewidth = 768
# This is the size of the image I was working with... this line will supress warnings about the image being too big
Image.MAX_IMAGE_PIXELS = 556631040
# Open the image
img = Image.open("original.png")
@CrowderSoup
CrowderSoup / footerExtend.js
Created May 20, 2014 22:58
Extend footer to take up the remainder of the viewport
var viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var footerDistanceFromTop = $('.footer').offset().top;
if (footerDistanceFromTop < viewportHeight) {
var footerHeight = viewportHeight - footerDistanceFromTop;
var footerMinHeight = parseInt($('.footer').css('min-height').split('px')[0]);
if (footerHeight > footerMinHeight) {
$('.footer').css('height', footerHeight + 'px');
}
@CrowderSoup
CrowderSoup / find_replace.js
Created February 19, 2014 16:40
Replace all instances of a substring without Regex in JavaScript
var str = 'This is a test string.';
// Let's replace all spaces with ','
str = str.split(' ').join(',');
@CrowderSoup
CrowderSoup / screenshot.js
Created January 24, 2014 23:16
A Phantom.js script to take a screenshot of any website.
var page = require('webpage').create(),
system = require('system'),
t, address;
if (system.args.length === 1) {
console.log('Usage: screenshot.js <some URL>');
phantom.exit();
}
address = system.args[1];