Skip to content

Instantly share code, notes, and snippets.

// run this in the javascript console, hit play on the vimeo video.
// when it's finished playing, the entire transcript should be in the "transcript" variable
var transcript = "";
var lastCaption = "";
function appendCaption() {
var cap = $(".vp-captions").text();
if(cap != lastCaption) {
transcript += " " + lastCaption;
// https://www.codewars.com/kata/complete-the-pattern-number-13/python
object Pattern {
def spaces(size: Int) = Seq.fill(size)(" ").mkString
// line is 0-indexed
def pattern(n: Int, xArg: Int = 1, line: Int = 0, acc: Seq[String] = Seq[String]()): String = {
val x = if(xArg <= 1) 1 else xArg
if(line < n) {
val numToPrint = (line + 1) % 10
# illustrates interesting effects of #extend
module Mixin
def testo
"in mixin"
end
end
@codeforkjeff
codeforkjeff / ipfs-api-encoding.py
Created January 25, 2016 22:40
possible encoding problem with ipfs-api
# run this with LC_ALL and LANG env vars set to "en_US.utf8"
import ipfsApi
utf8_filename = u"clich\xe9.txt".encode('utf8')
with open(utf8_filename, "w") as f:
f.write("this is just a test")
c = ipfsApi.Client('127.0.0.1', 5001)
# rbx -Xprofile -Xprofiler.graph -Xprofiler.full_report read_csv.rb
Finished in 50.60307312011719s, at rate of 195.04744260435427 rows/sec
===== Thread 1 =====
Total running time: 50.874820736000004s
index % time self children called name
----------------------------------------------------------
[1] 100.0 0.00 50.87 1 Rubinius::Loader#script [1]
0.00 50.87 1 Rubinius::CodeLoader.load_script [2]
-------------------------------------------------------
0.00 50.87 1 Rubinius::Loader#script [1]
import codecs
import subprocess
import sys
teststr = u'This is a block character: \u2588'
#### try #1: reproduce the problem
# demonstration of http://bugs.python.org/issue6135
@codeforkjeff
codeforkjeff / glob_test.sh
Created October 3, 2014 02:36
demo of "set -f" in bash
#!/bin/bash
# run this in a dir with some .zip files
# note that we do NOT escape glob patterns here
opts="-iname *.zip"
# normally, bash will expand *.zip and find will complain about arguments
echo "find will complain:"
find $opts
echo "========================================"
;; after list-buffers is called, switch to it
(defadvice list-buffers (after jc-switch-to-other-win)
(if (not (equalp (buffer-name (current-buffer))
"*Buffer List*"))
(other-window 1))
(goto-char (+ 4 (point))))
;; emacs24 doesn't recognize Buffer-menu-sort-column so we do this
;; nonsense: after list-buffers is called and we've switched to it,
;; check whether the buffer matches what's stored in
@codeforkjeff
codeforkjeff / gist:6373527
Last active December 21, 2015 22:09
twentytwelve-jeff child theme: functions.php
<?php
function twentytwelve_jeff_body_class( $classes ) {
if(isset($_SERVER['HTTP_USER_AGENT'])) {
if(strpos($_SERVER['HTTP_USER_AGENT'], "Chrome") !== false) {
$classes = array_diff($classes, array('custom-font-enabled'));
}
}
return $classes;
}
@codeforkjeff
codeforkjeff / gist:6373518
Last active December 21, 2015 22:09
twentytwelve-jeff child theme: style.css
/*
Theme Name: Twenty Twelve Child
Theme URI: http://codefork.com/
Description: Jeff's Tweaked Twenty Twelve
Author: Jeff
Author URI: http://codefork.com/
Template: twentytwelve
Version: 0.1.0