Skip to content

Instantly share code, notes, and snippets.

View vihanb's full-sized avatar
🐶
Probably at the doggo shelter

Vihan vihanb

🐶
Probably at the doggo shelter
View GitHub Profile
@vihanb
vihanb / chatgoat.js
Last active February 26, 2016 06:17
Chatgoat
// The Chatbot run on
// @Upgoat (StackExchange)
// http://codegolf.stackexchange.com/users/47996
function Speak(out,m) {document.getElementById("input").value=(m?":"+m.id.split("-")[1]+" ":"")+out;document.getElementById("sayit-button").click()}
Array.prototype.random = function() { return this.length ? this[Math.floor(Math.random() * this.length)] : "<broken goat/no items>" };
//console.log = (function(old){return function(){Speak.apply(this, arguments);old.apply(console, arguments)}}(console.log));
function WolframQuery(search,callback){var x=new XMLHttpRequest();x.onreadystatechange=function(){if(x.readyState===4){if(x.status===200){callback(x.responseXML)}}};x.open("GET","https://crossorigin.me/http://api.wolframalpha.com/v2/query?input="+encodeURIComponent(search)+"&appid=<TOP_SECRET_APP_ID>");x.send();}
@vihanb
vihanb / learning_bot.js
Last active December 16, 2015 02:29
A bot which learns english through conversation
// The Chatbot run on
// @Upgoat (StackExchange)
// http://codegolf.stackexchange.com/users/47996
// This Chatbot is designed for learning how to have a conversation
// It does this by having conversations with you, taking alternating parts
// Bascically through enough supervised learning it should be able to talk
function Speak(out,m) {document.getElementById("input").value=(m?":"+m.id.split("-")[1]+" ":"")+out;document.getElementById("sayit-button").click()}
Array.prototype.random = function() { return this.length ? this[Math.floor(Math.random() * this.length)] : "<broken goat/no items>" };
@vihanb
vihanb / PPCGDesign.js
Last active January 29, 2016 05:40 — forked from ConorOBrien-Foxx/WeArePPCG.js
A userscript to redesign the PPCG website
// ==UserScript==
// @name PPCG Design
// @namespace Doᴡɴɢᴏᴀᴛ
// @version 1
// @author Doᴡɴɢᴏᴀᴛ
// @grant none
// ==/UserScript==
function qS(x){
return document.querySelector(x);
@vihanb
vihanb / PPCGSandboxViewer.js
Last active January 16, 2016 04:39
A viewer that makes the sandbox more awesomer
var GETPOSTS = "https://api.stackexchange.com/2.2/questions/2140/answers?order=desc&sort=activity&site=meta.codegolf&filter=!)-gsFaSk.oj2nuNj6)8Hom.rAmUEuzZB.r0FZLYI";
function GetChallenges(user, callback) {
GetUserPosts(user, function(posts) {
callback(posts.map(function(post) {
return {
title: (post.body_markdown.match(/(?:^|\n)\s*(?:#+|\*\*)(.+?)(?:\*\*|#|\n|$)/)||["","Unknown Title"])[1],
score: {
up: post.up_vote_count,
down: post.down_vote_count
@vihanb
vihanb / testcases
Last active January 23, 2016 18:04
Header Parsing Challenge Test Cases
Pyth - <h2>Pyth, <s>40</s> <s>36</s> <s>34</s> 32 bytes</h2>
Ruby - <h2>Ruby (2.2.2p95), 124 bytes</h2>
TeaScript - <h1><a href="https://esolangs.org/wiki/TeaScript" rel="nofollow">TeaScript</a>, 16 bytes</h1>
Bash - <h1>Bash</h1>
Jelly - <h1>Jelly, 29 bytes</h1>
Pyth - <h2>Pyth, 17 bytes</h2>
JavaScript - <h1>JavaScript, 131238 - 10 = 131228 bytes</h1>
Vitsy - <h1>Vitsy, 40 bytes</h1>
Java - <h2>Java, 81 bytes</h2>
Brainf*ck - <h1>Brainf*ck, <s>489</s> 466 characters</h1>
@vihanb
vihanb / encoding.txt
Last active January 29, 2016 05:40
Unicorn, the language!
32: " "
33: "🐐"
34: "🦄"
35: "✨"
36: "🌈"
37: "1"
38: "2"
39: "3"
40: "4"
41: "5"
@vihanb
vihanb / downgoat1.jpg
Last active January 1, 2021 13:30
DowngoatUpgoatDowngoatUpgoat
downgoat1.jpg
@vihanb
vihanb / downgoat0.jpg
Last active June 12, 2018 19:20
(Up|Down)goat batch 2
downgoat0.jpg
@vihanb
vihanb / chatbeta.user.js
Created February 25, 2016 03:38
removed chat beta logo
// ==UserScript==
// @name No more chat beta!
// @namespace asdjhfkljashdflkjahsdlfkahsdlkjahsdlkf
// @version 0.1
// @description Graduates PPCG Chat
// @author Downgoat
// @match *://http://chat.stackexchange.com/*
// @grant none
// ==/UserScript==
@vihanb
vihanb / stahpwithusernamechanges.user.js
Last active February 27, 2016 17:45
stahp with username changes
// ==UserScript==
// @name stahp with username changes
// @namespace eoisdhfqlkjasdf
// @version 1.0
// @description self explanatory
// @author You
// @match *://*.stackexchange.com/*
// @grant none
// ==/UserScript==