Skip to content

Instantly share code, notes, and snippets.

Torgeir Thoresen torgeir

Block or report user

Report or block torgeir

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@torgeir
torgeir / redux-ish.clj
Created May 28, 2017 — forked from nhusher/redux-ish.clj
Redux with basically no effort in clojurescript, plus core.async to handle asynchronous actions
View redux-ish.clj
(ns reduxish.state-tools
(:require-macros [cljs.core.async.macros :refer [go go-loop]])
(:require [cljs.core.async.impl.protocols :refer [WritePort ReadPort]]
[cljs.core.async :refer [<!]]))
(defn channel? [ch]
(and (satisfies? WritePort ch) (satisfies? ReadPort ch)))
(defn dispatch! [reducer state value]
(println value)
@torgeir
torgeir / profile-with-chrome-devtools-and-improve--improved.html
Last active Mar 28, 2017 — forked from anonymous/debug-me.html
Faggruppemøte 2017-03-28: Performance: Profile and timeline debugging example, and improved version.
View profile-with-chrome-devtools-and-improve--improved.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Bad example to debug :D</title>
<style>
.colors .colorBlock {
display: inline-block;
width: 1em;
@torgeir
torgeir / clipboard-utils.clj
Last active Mar 1, 2017 — forked from Folcon/clipboard-utils.clj
Just a quick clipboard slip/slurp I put together because I didn't find anything similar, don't know if it's useful for anyone but found it invaluable when getting large strings being returned from the repl and sticking the result in an editor for more car
View clipboard-utils.clj
(defn get-clipboard []
(.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit)))
(defn slurp-clipboard []
(if-let [contents (.getContents (get-clipboard) nil)]
(.getTransferData contents java.awt.datatransfer.DataFlavor/stringFlavor)))
(defn spit-clipboard [text]
(.setContents (get-clipboard) (java.awt.datatransfer.StringSelection. text) nil))
@torgeir
torgeir / home-brew-link-all-programs-after-mavericks.sh
Last active Aug 29, 2015 — forked from lopopolo/gist:9427762
home-brew-link-all-programs-after-mavericks
View home-brew-link-all-programs-after-mavericks.sh
@torgeir
torgeir / drag.html
Last active Oct 7, 2017 — forked from paullewis/drag.html
dragndrop
View drag.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="style.css">
<title>Draggable</title>
</head>
@torgeir
torgeir / close_hidden_buffers.vim
Last active Oct 7, 2017 — forked from skanev/close_hidden_buffers.vim
close_hidden_buffers.vim
View close_hidden_buffers.vim
command! CloseHiddenBuffers call s:CloseHiddenBuffers()
function! s:CloseHiddenBuffers()
let open_buffers = []
for i in range(tabpagenr('$'))
call extend(open_buffers, tabpagebuflist(i + 1))
endfor
for num in range(1, bufnr("$") + 1)
if buflisted(num) && index(open_buffers, num) == -1
@torgeir
torgeir / tmux18-ubuntu-10-04
Last active Oct 7, 2017 — forked from lsaffie/tmux18-ubuntu-10-04
tmux18-ubuntu-10-04
View tmux18-ubuntu-10-04
#author: Luis Saffie <luis@saffie.ca>
#url: www.saffie.ca
#twitter: lsaffie
#
#tmux1.8 has some great features. One of them is pane zooming..
#http://blog.sanctum.geek.nz/zooming-tmux-panes/
#however, tmux 1.8 depends on libevent2 which does not come with 10.04
#solution: build from scratch!
#NOTE: LDFLAGS is used to build tmux because for some reason it can't find the ld_libs from libevent2.. Everything done by this script is legit thought...
#USAGE: wget https://gist.github.com/lsaffie/6335957/raw/tmux18-ubuntu-10-04 |bash
@torgeir
torgeir / gulpfile.js
Last active Apr 2, 2019 — forked from markgoodyear/01-gulpfile.js
Example gulpfile.js
View gulpfile.js
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
@torgeir
torgeir / demo.js
Last active Oct 7, 2017 — forked from gnab/demo.js
require js factory
View demo.js
define('itemFactory', function () {
function Item() {
this.value = Math.ceil(Math.random() * 1000);
};
return Item;
});
define('firstView', ['factory!itemFactory'], function (item) {
console.log('First view; ' + JSON.stringify(item));
View put-this-in-your-zshenv-or-bashrc.sh
for i in $HOME/local/*; do
[ -d $i/bin ] && PATH="${i}/bin:${PATH}"
[ -d $i/sbin ] && PATH="${i}/sbin:${PATH}"
[ -d $i/include ] && CPATH="${i}/include:${CPATH}"
[ -d $i/lib ] && LD_LIBRARY_PATH="${i}/lib:${LD_LIBRARY_PATH}"
[ -d $i/lib ] && LD_RUN_PATH="${i}/lib:${LD_RUN_PATH}"
# uncomment the following if you use macintosh
# [ -d $i/lib ] && DYLD_LIBRARY_PATH="${i}/lib:${DYLD_LIBRARY_PATH}"
[ -d $i/lib/pkgconfig ] && PKG_CONFIG_PATH="${i}/lib/pkgconfig:${PKG_CONFIG_PATH}"
[ -d $i/share/man ] && MANPATH="${i}/share/man:${MANPATH}"
You can’t perform that action at this time.