Skip to content

Instantly share code, notes, and snippets.

["awesome","cool","rad"].each do |word|
define_method(word.to_sym) do
word
end
end
puts awesome, cool, rad
@shelvacu
shelvacu / gist:7244069
Created October 31, 2013 03:39
Simple script to get optimal cookies per second from cookie clicker: http://orteil.dashnet.org/cookieclicker/ Although it doesn't factor in upgrades or wrinklers. Does nothing that you can't do manually. (except for speed)
//to clear all purchases:
Game.ObjectsById.forEach(function(o){for(var i=0;i<200;i++){o.sell()}})
var mostProfitable = -1;
var price = -1;
var interval = -1;
function determineBest(){
price = -1;
Game.ObjectsById.forEach(function(o){
@shelvacu
shelvacu / arrays.py
Created March 8, 2016 05:11
Proof that ruby is absolutely superior to python /sarcasm
a = []
a.append(a)
b = []
b.append(b)
print(a == b) #=> RecursionError: maximum recursion depth exceeded in comparison
require 'cinch'
$channels = ARGV
$votes = {}
$username = "shelvacubot"
$password = "oauth:XXXXXXXX"
.data
msg:
.ascii "hello, world!"
.text
.globl _start
_start:
movq $1, %rax
movq $1, %rdi
movq $msg, %rsi
movq $13, %rdx
# WARNING: VERY UGLY CODE AHEAD
#
# Documentation of sorts:
# This is a library, so you have to require it eg require 'parker-chainfinder2.rb'
# The functions are:
#
# - translate(number)
# This translates from an integer to its english representation
# translate(5) #=> "Five"
# translate(5352) #=> "Five Thousand Three Hundred Fifty Two"
DtHIqH18R0IqH13R1K0FbjH2=+K-4b)RtKJsmtdr1QJ-QJ
DtH Define method t with argument H
IqH18 If H is equal to 18
R0 Return 0 (implicitly ends If block)
IqH13 If H is equal to 13
R1 Return 1
K0 Set variable K to 0
Fb For every value in 'jH2', set variable b to that value and execute block
jH2 Convert H to base 2 as an array of integers
=+K Set K to K + '-4b'
@shelvacu
shelvacu / clean_amazon.adblock_rules
Last active January 22, 2017 08:36 — forked from AustinSpafford/clean_amazon.adblock_rules
AdBlock rules for cleaning up Amazon's storefront.
feedly.com##div#discoverModule_part
feedly.com##div#herculePanel
//s3.feedly.com/production/head/images/icon-action-markasread.png
! Main page ad-carousel, recommendations, and ad-grid
amazon.com##div#gw-desktop-herotator
amazon.com##div#rhf-container
amazon.com##div#gw-content-grid
! Title bar department-menu and middle-ads
@shelvacu
shelvacu / gist:d6621fb90248846f64c8a2a765076d5d
Last active February 15, 2017 11:31 — forked from liaohuqiu/gist:4ee77b9b03afcdecc80252252378d367
Find out the full duration time of a YouTube playlist
var list = document.getElementsByClassName('pl-video-time');
var time = 0;
function toS(hms) {
var a = hms.split(':');
while (a.length < 3) {
a.unshift(0);
}
var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);
return seconds;
# CC0: To the extent possible under law, Shelvacu has waived all copyright and related or neighboring rights to Reddit Place Event Recorder. This work is published from: United States.
# A ugly but simple logger for every event (pixel placements, participation number updates) on www.reddit.com/place
# First you need to `gem install websocket-client-simple`
require 'websocket-client-simple'
require 'open-uri'
$logprefix = "pixel-placement"
$lines = 0