This file contains hidden or 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
//Please excuse the horrible comments. Maybe when my head works again I'll clean this up. Tested at https://sange.fi/esoteric/brainfuck/impl/interp/i.html | |
// {x} {y} {tmp0=0} {tmp1=0} {dir = 0 to 3} {num} | |
// ^ | |
//{tmp1} | |
, //read L/R | |
[ | |
---------------------------------------------------------------------------- //subtract 76 to make L 0 | |
[ //if it's not 0 (It was an R) | |
> //{tmp2(0)} |
This file contains hidden or 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
<!-- We were using FontAwesome for our icons, but then found that some clients have blocked the downloading of custom fonts. | |
To resolve this issue, we had to switch all our fonts to svgs instead. | |
Someone else has already converted FontAwesome to svgs/pngs, so we started with that repo ( https://github.com/CodeCharmLtd/Font-Awesome-SVG-PNG ) | |
We decided to put our svgs in a sprite sheet and after a decent amount of trial and error, got things working. | |
Here's a code snippet; hope this helps! | |
More about this issue at https://github.com/FortAwesome/Font-Awesome/issues/3203 | |
--> | |
<!-- SVG sprite sheet included once on the page. | |
It it hidden, but needs to be present so that other svgs can refer to these paths.--> |
This file contains hidden or 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
#!/usr/bin/env bash | |
if [ "$#" -ne 2 ] | |
then | |
echo "move a directory to a new location. | |
While normally, git mv old-dir new-dir should work, let's say you do that and then try to merge in another branch where someone's added new files to old-dir. | |
these files will stay in old-dir, and we need a way to merge their (arbitrarily deeply nested) contents into new-dir. This script uses cp -r to merge the contents, | |
followed by git add/rm. When you do git status, it should now show that all those files have been moved. | |
Warning: script will add the whole target directory, including uncommitted changes on files that existed before it ran." | |
echo "usage: $0 <old-dir> <new-dir>" |
This file contains hidden or 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
function! SplitRegex() | |
tabnew | |
setlocal buftype=nofile bufhidden=hide noswapfile | |
let numlines=len(@") | |
execute "normal! V".numlines."pggjl" | |
let tmp=@z | |
let @z="hv0r wlv$r j" | |
execute "normal! ".(numlines-2)."@z" | |
let @z=tmp | |
execute "normal! gglv$r\<space>" |
This file contains hidden or 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
import sys, re #thumbtack pycon tetris challenge. "dense" solution by @mattboehm | |
def shift_down(col):#shift piece down 1 space | |
loc = "".join(col[::-1]) | |
space = loc.find("#") - 1 | |
return col if loc == -2 else list(loc[:space] + loc[space+1:] + ".")[::-1] | |
def top_row_blank(board):#check if the top row has only . | |
return all(tile == "." for tile in board[0]) | |
def find_piece(board):#Replace the X's for the piece with # | |
board, marked_board = board[:], [] | |
while top_row_blank(board):#skip top blank rows |
This file contains hidden or 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
nnoremap <silent> <leader>gm :tab split<CR>:Glistmod<CR> | |
nnoremap <silent> <c-s-j> :call g:DiffNextLoc()<CR> | |
nnoremap <silent> <c-s-k> :call g:DiffPrevLoc()<CR> | |
command! Glistmod only | call g:ListModified() | Gdiff | |
function! g:ListModified() | |
let old_makeprg=&makeprg | |
let old_errorformat=&errorformat | |
let &makeprg = "git ls-files -m" | |
let &errorformat="%f" |
This file contains hidden or 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
#tl: list sessions | |
alias tl='tmux ls' | |
#tn <name>: create a session named <name> | |
alias tn='tmux -2 new -s' | |
#ta <name>: attach to a session named <name> | |
alias ta='tmux -2 attach -t' | |
This file contains hidden or 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
"with your cursor on a line or a block selected, type `:HL` | |
"to remove, on each line call :sign unplace | |
highlight HL ctermbg=darkgray | |
sign define hl linehl=HL | |
let s:highlightLineSignId = 74000 | |
function! g:HighlightLine() | |
execute 'sign place' s:highlightLineSignId 'line='.line(".") 'name=hl' 'file='.expand("%") | |
let s:highlightLineSignId += 1 | |
endfunction | |
command! HL call g:HighlightLine() |
This file contains hidden or 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
"These lines map a hotkey that allow you to easily execute the current line or | |
"selection by hitting F9. It's a cheesy hack that made demoing while reading | |
"through this more simple. | |
" | |
"This is also why commands start with colons. Normally colons would be | |
"unnecessary if trying to execute these in your vimrc. | |
:nnoremap <F9> "ayy@a | |
:vnoremap <F9> "ay@a | |
"Marks {{{ |
This file contains hidden or 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
"I recorded a macro of the command. These are the keystrokes I hit to do one line | |
"To do all lines, I recorded the macro in register q (starting on the first line of names.csv) | |
"then did 2@q to repeat macro twice more. | |
"This assumes the template is in the same dir and is very brittle | |
"You should use a templating engine like genshi for non-trivial templating, but just wanted to show that this is possible | |
"Creates $email.html file for each email address. | |
0"ayt,f,l"by$:new^M;read template.html^M:%s;\$EMAIL;^Ra;g^M:s;$NAME;^Rb;g^M:w! ^Ra.html^M:bd^Mj |