Skip to content

Instantly share code, notes, and snippets.

View wakatara's full-sized avatar

Daryl Manning wakatara

View GitHub Profile
@lbonn
lbonn / sway-window-menu
Created April 22, 2020 10:55
Window switcher for sway ('rofi -show window' clone)
#!/usr/bin/env bash
set -euo pipefail
tree=$(swaymsg -t get_tree)
readarray -t win_ids <<< "$(jq -r '.. | objects | select(has("app_id")) | .id' <<< "$tree")"
readarray -t win_names <<< "$(jq -r '.. | objects | select(has("app_id")) | .name' <<< "$tree")"
readarray -t win_types <<< "$(jq -r '.. | objects | select(has("app_id")) | .app_id // .window_properties.class' <<< "$tree")"
switch () {
@danielberkompas
danielberkompas / scheduler.ex
Created October 26, 2016 17:59
A simple mix task scheduler for Elixir apps
defmodule MyApp.Scheduler do
@moduledoc """
Schedules a Mix task to be run at a given interval in milliseconds.
## Options
- `:task`: The name of the Mix task to run.
- `:args`: A list of arguments to pass to the Mix task's `run/1` function.
- `:interval`: The time interval in millisconds to rerun the task.
@wikimatze
wikimatze / gist:6332795
Last active December 21, 2015 16:19
Bring padrino to the next level

I recently had the pleasure to meet Darío at eurucamp 2013 in wonderful Berlin to discuss issues with the further development of Padrino. Here are the following points we need to think over.

Handling Mailing List

As recently posted on our mailing list with the sql problem, we have problems with some posted activities which are not shown up on the page. Apparently, we I can't find the post anymore which mentioned this issue.

Questions needs to be answered:

  • Who is responsible to admin the presence (checking options, help new members with registration)
  • Should all main contributors have access to the settings?
@tatey
tatey / gist:6331296
Last active December 21, 2015 16:09
The good ol' fashion way of restricting params in a controller. In response to https://twitter.com/awws/status/371437294776901632
class PostsController
def create
@post = Post.new post_params
@post.save
respond_with @post
end
private
def post_params
@dqminh
dqminh / applause_formatter.rb
Last active December 18, 2015 04:59
rspec formatter that applause you when your tests pass
require "rspec/core/formatters/progress_formatter"
class ApplauseFormatter < RSpec::Core::Formatters::ProgressFormatter
def initialize(output)
super(output)
unless File.exists? "/tmp/applause.mp3"
p "Downloading applause for awesomeness"
system "wget http://www.soundjay.com/human/applause-1.mp3 -O /tmp/applause.mp3"
end
end
@wakatara
wakatara / Things2Taskpaper
Created February 27, 2013 04:38
A Applescript to migrate all tasks out of Cultured Code's THings for OSX and put them in the proper text format for Taskpaper from Hog's Bay Software.
-- modified on 21 Feb 2013 by Daryl Manning
set thePath to (path to desktop as Unicode text) & "Things2Taskpaper.taskpaper"
set thingsToDoFile to (open for access file thePath with write permission)
set eof of thingsToDoFile to 0
set cr to ASCII character 10
tell application "Things"
-- Export to-dos from Inbox
write "Inbox:" & return to thingsToDoFile as «class utf8»
@railwaycat
railwaycat / mac-switch-meta.el
Created August 28, 2012 13:43
meta key switch
;; Keybonds
(global-set-key [(hyper a)] 'mark-whole-buffer)
(global-set-key [(hyper v)] 'yank)
(global-set-key [(hyper c)] 'kill-ring-save)
(global-set-key [(hyper s)] 'save-buffer)
(global-set-key [(hyper l)] 'goto-line)
(global-set-key [(hyper w)]
(lambda () (interactive) (delete-window)))
(global-set-key [(hyper z)] 'undo)
@abitgone
abitgone / bootstrap-grid.css
Created February 29, 2012 14:47
Grid Overlay for Twitter Bootstrap
/*
* Grid Overlay for Twitter Bootstrap
* Assumes a 1.692em baseline grid (22px/13px)
*/
@media (min-width: 1200px) {
body {
background: -webkit-gradient(linear, top left, bottom left, color-stop(0%, rgba(0, 0, 0, 0.05)), color-stop(4.545%, rgba(0, 0, 0, 0.05)), color-stop(4.545%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0))), -webkit-gradient(linear, top left, top right, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(35%, rgba(0, 0, 0, 0)), color-stop(35%, rgba(0, 0, 0, 0.05)), color-stop(36%, rgba(0, 0, 0, 0.05)), color-stop(36%, rgba(0, 0, 0, 0)), color-stop(65%, rgba(0, 0, 0, 0)), color-stop(65%, rgba(0, 0, 0, 0.05)), color-stop(66%, rgba(0, 0, 0, 0.05)), color-stop(66%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0))), -webkit-gradient(linear, top left, top right, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(0%, rgba(0, 0, 0, 0.1)), color-stop(0.085%, rgba(0, 0, 0, 0.1)), color-stop(0.085%, rgba(0, 0, 0, 0)));
background: -webkit-linear-gradient(90deg, rgba(0, 0, 0, 0.05), rgba(
@bjeanes
bjeanes / README.md
Created November 23, 2011 22:24
Easily fold everything not relevant to your current spec

Easily fold everything not relevant to your current spec

Usage / Example

Just hit <Leader>rf (rspec focus) to fold all example groups in the entire file except the full hierarchy to your spec that your cursor is inside. The current example is automatically centered on your screen, when possible.

This lets you easily see all the context/describe blocks that apply just to the current spec. See:

example

@benhoskings
benhoskings / application_controller.rb
Created September 1, 2011 00:04
A git ref in every response!
class ApplicationController < ActionController::Base
before_filter {
headers['X-Refspec'] = TC::Services.refspec
}
end