This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Shell script that configures gnome-terminal to use solarized theme | |
# colors. Written for Ubuntu 11.10, untested on anything else. | |
# | |
# Solarized theme: http://ethanschoonover.com/solarized | |
# | |
# Adapted from these sources: | |
# https://gist.github.com/1280177 | |
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 "========================================" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# illustrates interesting effects of #extend | |
module Mixin | |
def testo | |
"in mixin" | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-replace (regex rep str &optional start) | |
(save-match-data | |
(let ((found-pos (string-match regex str (or start 0)))) | |
(if found-pos | |
(let* ((match (substring str found-pos (match-end 0))) | |
(replacement (if (stringp rep) | |
rep | |
(or (funcall rep match) "")))) | |
(my-replace regex | |
rep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-replace (regex rep str &optional start) | |
"Replace matches of regex in str with the result of applying | |
rep function to the match. | |
This exists because of a quirk in replace-regexp-in-string: | |
because it calls the REP function in a while loop that uses | |
string-match and replace-match, the REP function can't use | |
string-match without messing up the match state in the loop. | |
If rep returns nil, an empty string is used as the |
NewerOlder