This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"school": "General Assembly", | |
city: "San Francisco", | |
course: "Web Development Immersive", | |
course_id: "WDI22", | |
classrootm: "1", | |
students: [{ | |
id: 0, | |
last_name: "Aramayo", | |
first_name: "Angelo", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var prompt = require('prompt'); | |
prompt.start(); | |
WELCOME = [ | |
"Welcome to Camel Run!" , | |
"You have stolen a camel (you egg!) to make your way across the great Mobi desert." , | |
"The townspeople want their camel back and are chasing you down! Survive your" , | |
"desert trek and outrun the blockos." , | |
"Only drink when necessary. Always use E. to display your status!" , | |
"Do not let your thirst go above 6 and your camel's tiredness above 8." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import praw, time, csv, random, itertools, requests | |
BOT = 'spirit_of_mckenna' | |
PASSWORD = "" #not actual password | |
KEYWORD = "mckenna" | |
SLEEP_MESSAGE = "Sleeping for 12 hours..." | |
BY_LINE = " -Terence McKenna" | |
USER_AGENT = "When people reference McKenna, I provide a quote of his, /u/spirit_of_mckenna" | |
SUBREDDITS = [ 'test', | |
'psychonaut', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MESSAGES = [ | |
"Choose your weapon", | |
"Computer has chosen ", | |
"TIE!", | |
"Computer Wins", | |
"You Win!" | |
] | |
def run | |
puts MESSAGES[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rovarspraket(string) | |
vowels = ['a','e','i','o','u' 'y', 'Å', 'Ä', 'Ö'] | |
vowels.each{|vowel| vowel.downcase!} | |
answer = "" | |
string.each_char do |char| | |
if char =~ /[[:alpha:]]/ | |
unless vowels.include?(char) || vowels.include?(char.downcase) | |
answer += char + 'o' + char.downcase | |
else | |
answer += char |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# finished | |
PUZZLES = [ | |
"105802000090076405200400819019007306762083090000061050007600030430020501600308900", | |
"005030081902850060600004050007402830349760005008300490150087002090000600026049503", | |
"105802000090076405200400819019007306762083090000061050007600030430020501600308900", | |
"005030081902850060600004050007402830349760005008300490150087002090000600026049503", | |
"005030081902850060600004050007402830349760005008300490150087002090000600026049503", | |
"290500007700000400004738012902003064800050070500067200309004005000080700087005109", | |
"080020000040500320020309046600090004000640501134050700360004002407230600000700450", | |
"608730000200000460000064820080005701900618004031000080860200039050000100100456200", |
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 2 columns, instead of 4 in line 2.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
“I think of going to the grave without having a psychedelic experience like going to the grave without ever having sex. It means that you never figured out what it is all about. The mystery is in the body and the way the body works itself into nature.”, | |
“Stop consuming images and start producing them.”, | |
“You are a divine being. You matter, you count. You come from realms of unimaginable power and light, and you will return to those realms.”, | |
“You are an explorer, and you represent our species, and the greatest good you can do is to bring back a new idea, because our world is endangered by the absence of good ideas. Our world is in crisis because of the absence of consciousness.”, | |
“The male dominant agenda is so fragile that any competitor is felt as a deadly foe.”, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# UPDATED 7/15 | |
# Thanks to kootenpv for the code review! | |
# This makes it easy to create a reddit bot that | |
# A. Grabs comments from subreddits of your choice | |
# B. Searches for a keyword | |
# C. Replies to comments with that keyword from a list of responses on a CSV file | |
# Follow correct etiquette: | |
# https://www.reddit.com/r/Bottiquette |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class KMP | |
attr_reader :results | |
def initialize string, pattern | |
@string = string | |
@pattern = pattern | |
@string_length = string.length | |
@pattern_length = pattern.length | |
@table = kmp_table | |
@results = [] | |
kmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Horspool algorithm implements the good suffix rule. | |
# If the char is not present, it still skips ahead by the length of the pattern. | |
# If the char is not a match, but it is present in the string, it jumps forward by the appropriate ammount. | |
# pattern_length if char not in pattern is found | |
# function accepts a string and a pattern and returns the index in the string where | |
# the pattern first occurs, or "not found" | |
def brute_search_2 string, pattern | |
pattern_length = pattern.length | |
bad_match_table = Hash.new |