Skip to content

Instantly share code, notes, and snippets.

View scmx's full-sized avatar

Albert Arvidsson scmx

View GitHub Profile
@scmx
scmx / README.md
Last active November 29, 2022 13:28 — forked from tessalt/gruntfile.js
Update 0.4.1 gruntfile with additions to support both jade and html. Add separate diff with changes needed after using generator-angular 0.5.1 Create a new app with `yo angular` and then apply this diff
@scmx
scmx / pomodoro.sh
Last active December 31, 2015 21:08
Minimalistic pomodoro for OSX with Skype integration. EDIT: Here is an alternative: https://gist.github.com/scmx/8234441
#!/usr/bin/env bash
usage() {
cat <<EOD
Usage:
pomodoro [minutes] Start a pomodoro, defaults to 25 minutes
EOD
}
case "$1" in
@scmx
scmx / .thymerc
Last active December 1, 2017 09:21
thyme pomodoro configured to change skype status and say -v albert "pomodoro"
#!/usr/bin/env ruby
set :tmux, true
before do
%x(~/bin/set-skype-status DND)
%x(say -v albert 'pomodoro started')
end
after do
@scmx
scmx / README.md
Created January 31, 2014 11:46
ERB example

Ruby ERB example

# Kompilera erb-filen till html
ruby example.rb

# Visa resultatet i webbläsaren
open index.html
@scmx
scmx / removing-duplicate-records-rails4.rb
Last active July 5, 2017 20:10
Removing duplicate records Rails 4 #rails4, #uniqueness, #accepts_nested_attributes_for
# Related article
# http://robots.thoughtbot.com/accepts-nested-attributes-for-with-has-many-through
# Pluck ids
arr = CompanyEmployment.pluck(:company_id, :company_user_id)
#=> [[1,1], [1,2], [2,1], [2,1]]
# Select duplicates http://stackoverflow.com/a/8922408/2037928
dups = arr.select {|e| arr.rindex(e) != arr.index(e) }.uniq
#=> [[2,1]]
@scmx
scmx / upgrade-install-ruby-2-1-2-ubuntu-12-04.md
Last active November 6, 2019 15:31
Upgrade/Install ruby 2.1.2 #ubuntu #12.04 #14.04

Upgrade/Install ruby 2.1.2

ubuntu 12.04 14.04

Reference http://stackoverflow.com/a/18490935/2037928

Login as root

Install needed packages

apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
@scmx
scmx / README.md
Last active August 29, 2015 13:57
@scmx
scmx / Gruntfile.js
Created March 31, 2014 14:58
Gruntfile.js #grunt-connect-proxy #rsync #deploy #jade
// Generated on 2013-11-12 using generator-angular 0.5.1
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
//
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
@scmx
scmx / .bashrc
Last active August 29, 2015 13:59
#tmux #testing #rake #vim
# Infinitely do something, wait half a second between iterations
infdo () {
while true; do
$@
echo "restarting $@..."
sleep 0.5
done
}
@scmx
scmx / README.md
Last active August 29, 2015 13:59
#crontab #cronjob #guide #osx
# Skapa en fil ~/cronjob.sh

# Testinnehåll för filen, skapar en ny fil varje minut om det fungerar
touch ~/$(date +%%Y%m%d-%H%M)

# Se till att filen är körbar
chmod +x ~/cronjob.sh

# Öppna crontab i en editor