Skip to content

Instantly share code, notes, and snippets.

View JCGrant's full-sized avatar
🤓

James Grant JCGrant

🤓
View GitHub Profile
@JCGrant
JCGrant / shush.se-x.user.js
Last active November 10, 2016 23:05
Adds various features to Shush.se
// ==UserScript==
// @name Shush.se - Extra Features
// @namespace https://gist.github.com/JCGrant/45fdb9a8a14d7c05dc6ac70123f2d7cb
// @version 0.5
// @description Adds various features to Shush.se
// @author JCGrant
// @match http://www.shush.se/index.php*
// @grant none
// @updateURL https://gist.github.com/JCGrant/45fdb9a8a14d7c05dc6ac70123f2d7cb/raw/shush.se-x.user.js
// ==/UserScript==

Keybase proof

I hereby claim:

  • I am JCGrant on github.
  • I am jcgrant (https://keybase.io/jcgrant) on keybase.
  • I have a public key whose fingerprint is B919 ED51 D5B6 464F DE65 8485 1EBB D452 BD82 D307

To claim this, I am signing this object:

@JCGrant
JCGrant / AppendedSquareChains.hs
Created December 3, 2015 06:21
Chains of square numbers which remain squares when repeatedly adding digits. [1,16,169] appears to be the only chain with a length greater than 2.
import Data.Maybe
isSquare :: Integer -> Bool
isSquare x
= root ^ 2 == x
where
root = floor $ sqrt $ fromIntegral x
append :: [Integer] -> Integer -> [Integer]
append ys x
@JCGrant
JCGrant / SquaresAndTS.hs
Last active December 3, 2015 01:55
Square numbers which remain squares with the last digit removed
isSquare :: Integer -> Bool
isSquare x
= root ^ 2 == x
where
root = floor $ sqrt $ fromIntegral x
isTruncatedSquare :: Integer -> Bool
isTruncatedSquare x
| x < 10 = False
| otherwise = isSquare $ x `div` 10