Skip to content

Instantly share code, notes, and snippets.

<canvas id="gc" width="400" height="400"></canvas>
<script> // https://youtu.be/xGmXxpIj6vs?t=3m46s
window.onload=function() {
canv=document.getElementById("gc");
ctx=canv.getContext("2d");
document.addEventListener("keydown",keyPush);
setInterval(game,1000/15);
}
px=py=10; // player x,y
1 #!/usr/bin/env python
2 import re, sys, collections
3
# open the file and split on commas.
4 stops = open(’../stop_words.txt’).read().split(’,’)
# what is the re.findall()? what does {2,} mean?
# read file specified by command line arguments, convert to lower case, findall a-zs
5 words = re.findall(’[a-z]{2,}’, open(sys.argv[1]).read().lower())
# what is collections.Counter()?
# increment counts[w] for w in words, if it isn't in Stop Words.
<html>
<body>
<h1>Seasonal fruits and vegetables in Ontario, sorted by month</h1>
<p>Data source: www.foodlandontario.ca</p>
<div id="results"></div>
</body>
<script>
## .nanorc examples from http://www.if-not-true-then-false.com/2009/tuning-nano-text-editor-with-nanorc/
## charleyramm@gmail.com 11 December 2015.
set smooth
set autoindent
set backup
set backupdir "/tmp/nano-backups"
set historylog
$OUTPUT_AUTOFLUSH = 1; # this thing turns off buffering between newlines
while (1) {
print "perl% ";
my $command = <STDIN>; # get some user input
last if $command eq ''; # exit the loop
chomp $command; # remove newline from our input
my ($program, @args) = split /\s+/, $command;
my $pid = fork;
if (! defined $pid) { print STDERR "Couldn't fork: $!\n" }
@charleyramm
charleyramm / customizer.css
Created November 4, 2015 17:38
Custom styles for the WordPress Twenty Twelve theme as seen on www.norwichmedievalchurches.org
hgroup {
padding-top: 96px;
background-image: url('https://norwichchurches.files.wordpress.com/2015/05/luckhurst-nchchurches-31.jpg?w=192');
background-repeat: no-repeat;
background-position: top center;
background-size: 96px 96px;
min-height: 96px;
}
.site-header h1 {
def solution(a)
n = a.size
prefix_sum = [0]
a.each do |e|
prefix_sum << prefix_sum.last + e
end
h1 {
font-size: 1.25em;
}
h2 {
font-size: 1.125em;
}
h3 {
font-size: 1.05em;
<!-- if the page has children: we want to display them in a gallery of featured images -->
<?php
if ($children = get_children(array( 'post_parent' => $post->ID ))){
foreach ($children as $child){
$link = get_permalink($child->ID);
echo "<div class='col-md-4 text-center fabric-child'>";
echo "<a href='$link'>";