Skip to content

Instantly share code, notes, and snippets.

View romgrk's full-sized avatar
♥️
hey

Rom Grk romgrk

♥️
hey
View GitHub Profile
" File: definition.vim
" Author: romgrk
" Date: 13 May 2016
" Description: Jump where the given expression was last set.
" !::exe [so %]
command! -nargs=* -complete=expression Goto call <SID>goto(<q-args>)
" Example mappings:
" nmap <leader>gc :Goto command<space>
" Gothik functions "{{{
function! Gothik (string)
let result = ''
let len = len(a:string)
let n = 0
while (n < len)
let result .= s:gothik(a:string[n])
let n += 1
endwhile
#!/bin/zsh
# Usage: $ savepull [dir]
#
# Default:
# dir = ./
#
# Updates the master branch of the specified git repository
# from upstream (aka origin/master), but handles dirty directory
# by stashing the state, switching to master, then coming back to
# the initial branch & pop-stashing automatically.
" cs'' => will switch surrounding simple/double quotes
" cs'[x] => will delegate to vim-surround
nmap <expr>cs' CSurroundQuotes()
fu! CSurroundQuotes()
let qch = s:findQuote()
let char = s:getChar('Question', 'Exchange quotes with?')
if char == "'"
let char = (qch ==# "\"" ? "'" : "\"") | end
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
@romgrk
romgrk / index.ts
Last active January 25, 2017 04:24
/// <reference path="../typings/tsd.d.ts" />
import * as _ from 'lodash';
import {GtkWindow, NtkWindow} from './view';
import GI = require('node-gtk');
// GI imports
const Gdk: any = GI.require('Gdk', '3.0');
const Gtk: any = GI.require('Gtk', '3.0');
@romgrk
romgrk / webcam_picture.js
Last active September 26, 2016 20:31
take a picture in the browser using the webcam
// Pops up a popup to take a picture in the browser using the webcam. (Vanilla JS)
// Returns a promise which resolves to a data URI ('image/jpeg;base64,...')
// Tested with chrome 54.x
//
// Example:
// capturePhoto().then(data => document.querySelector('img').src = data)
//
// MIT license. Romgrk, 2016.
const capturePhoto = () => {
@romgrk
romgrk / autostart.zsh
Created October 13, 2016 07:47
Add an command to run when your desktop session starts
#!/usr/bin/env zsh
# Usage: autostart [title] [command]
#
echo "[Desktop Entry]
Name=$1
Terminal=false
Type=Application
Exec=$2" >> ~/.config/autostart/$1.desktop
import {
inspect,
createToken, Token} from '../common';
let stringConcat = (prev: string, cur: string) => prev.concat(cur)
function tokensToString (tokens: Token[]) {
return tokens.map(t => t.text)
.reduce(stringConcat, '');
}
import _ from 'lodash';
import {
Position, Location, Size,
Token, createToken, attributesFromStore,
minMax, inspect, getFontSize, } from '../common';
import {
create, addClass, removeClass, toggleClass, clearNode,
} from '../dom';
import TextRegion from '../dom/region';