Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexander Craggs popey456963

View GitHub Profile
View gist:b0cda057b9c202274c7de0a8c8514c5a
// schrodingers value
true == []; // -> false
true == ![]; // -> false
// reading between the lines
(![] + [])[+[]] +
(![] + [])[+!+[]] +
([![]] + [][[]])[+!+[] + [+[]]] +
(![] + [])[!+[] + !+[]];
// -> 'fail'
View header.css
.wrapper{
display:block;
overflow:hidden;
position:relative;
width:100%
}
.wrapper .container{
/*max-width:80rem*/
}
.wrapper>.container{
View bot.py
import collections
import operator
import sys
import uuid
# Optimization helpers.
def memoize(func):
"""Memoizing decorator for functions which take a grid as their first argument. Since a grid is 1) large and
View skel_commented.py
#Skeleton Program code for the AQA A Level Paper 1 2017 examination
#this code should be used in conjunction with the Preliminary Material
#written by the AQA Programmer Team
#developed in the Python 3.4.1 programming environment
# Enumerate over a class
import enum
# Contains functions to generate random numbers, pick a random item from
# an array, etc.
import random
@popey456963
popey456963 / bot.js
Created Jan 29, 2017
JavaScript Wrapper
View bot.js
var chalk = require('chalk')
var generate = require('project-name-generator')
var Bot = function() {
this.pastPlayers = 0
this.playerIndex = 0
this.colours = {
"empty": chalk.gray,
"mountain": chalk.white,
"unknown": chalk.yellow,
View error.js
C:\Users\Alexander\Documents\GitHub\generals.io\node_modules\jstransform\src\jstransform.js:277
throw e;
^
at throwError (C:\Users\Alexander\Documents\GitHub\generals.io\node_modules\jstransform\node_modules\esprima-fb\esprima.js:2808:21)
at throwUnexpected (C:\Users\Alexander\Documents\GitHub\generals.io\node_modules\jstransform\node_modules\esprima-fb\esprima.js:2870:9)
at parsePrimaryExpression (C:\Users\Alexander\Documents\GitHub\generals.io\node_modules\jstransform\node_modules\esprima-fb\esprima.js:3575:9)
at parseLeftHandSideExpressionAllowCall (C:\Users\Alexander\Documents\GitHub\generals.io\node_modules\jstransform\node_modules\esprima-fb\esprima.js:3656:61)
at parsePostfixExpression (C:\Users\Alexander\Documents\GitHub\generals.io\node_modules\jstransform\node_modules\esprima-fb\esprima.js:3696:20)
at parseUnaryExpression (C:\Users\Alexander\Documents\GitHub\generals.io\node_modules\jstransform\node_modules\esprima-fb\esprima.js:3763:16)
at parseBinaryExpression (
View bot.js
var chalk = require('chalk')
var generate = require('project-name-generator')
var Bot = function() {
this.pastPlayers = 0
this.playerIndex = 0
this.colours = {
"empty": chalk.gray,
"mountain": chalk.white,
"unknown": chalk.yellow,
View bot.js
var socket = require('socket.io-client')('http://localhost:8080', { transports: ['websocket'] })
var chalk = require('chalk')
var listen_events = ['queue_update', 'game_update']
socket.on('connect', function() {
console.log('Connected Successfully')
socket.emit('play', 'Beep Boop', 'Sy5tdf37g')
socket.emit('set_force_start', null, true)
})
@popey456963
popey456963 / main.py
Created Dec 10, 2016
[2016-12-09] Challenge #294 [Intermediate] Rack management 2 (Bonus 2)
View main.py
# [2016-12-09] Challenge #294 [Hard] Rack management 3
# https://www.reddit.com/r/dailyprogrammer/comments/5hcd0x/20161209_challenge_294_hard_rack_management_3/
import copy, random, timeit
original_row = "sd?zeioao?mluvepesceinfxt?wyiru?ie?giator?t??nuefje?l?odndrotpewlgoobiinysagacaqski?aeh?rbhaervtnl?m"
words = [[line.strip(), 0] for line in open("enable1.txt") if len(line.strip()) < 21]
letters = "abcdefghijklmnopqsrtuvwxyz"
scores = [1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,1,1,1,4,4,8,4,10]
practice = False
@popey456963
popey456963 / main.py
Last active Dec 10, 2016
[2016-12-09] Challenge #294 [Intermediate] Rack management 2 (Bonus 1)
View main.py
# [2016-12-09] Challenge #294 [Intermediate] Rack management 2
# https://www.reddit.com/r/dailyprogrammer/comments/5h40ml/20161207_challenge_294_intermediate_rack/
import copy, random, timeit
words = [[line.strip(), 0] for line in open("enable1.txt") if len(line.strip()) < 11]
tilescores = dict(zip("abcdefghijklmnopqrstuvwxyz?", [1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,1,1,1,4,4,8,4,10,0]))
char_freq = {'a': 22, 'c': 15, 'b': 9, 'e': 25, 'd': 16, 'g': 13, 'f': 7, 'i': 23, 'h': 10, 'k': 6, 'j': 1, 'm': 11, 'l': 17, 'o': 19, 'n': 20, 'q': 0, 'p': 12, 's': 24, 'r': 21, 'u': 14, 't': 18, 'w': 5, 'v': 4, 'y': 8, 'x': 2, 'z': 3}
def calcScore(word):