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
| my_packages = c("dplyr") | |
| install_if_missing = function(p) { | |
| if (p %in% rownames(installed.packages()) == FALSE) { | |
| install.packages(p) | |
| } | |
| else { | |
| cat(paste("Skipping already installed package:", p, "\n")) | |
| } | |
| } |
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
| require 'sinatra' | |
| require 'rinruby' | |
| # root page | |
| get '/' do | |
| sample_size = 10 | |
| html = "<html>" | |
| html += "<head><title>R Code Test</title></head>" |
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
| Out of process interface to R using Redis |
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
| # gem code | |
| module Trailblazer | |
| class Operation | |
| def self.inherited(klass) | |
| qualified_name = klass.name | |
| name_parts = qualified_name.split('::') | |
| method_name = name_parts.last |
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
| Vagrant - InfluxDb + Nginx + Grafana |
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
| # -*- coding: utf-8 -*- | |
| # Rename files based on the episode title | |
| # Copyright (c) 2014-09-25 Chris Stefano <virtualstaticvoid@gmail.com> | |
| # Licensed under the same terms as gPodder itself | |
| # Source code copied and modified from https://github.com/gpodder/gpodder/blob/master/share/gpodder/extensions/rename_download.py | |
| import os | |
| import gpodder | |
| from gpodder import util |
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
| #!/bin/bash | |
| comment=${1:-"Autosaved at $(date +%Y)-$(date +%m)-$(date +%d) $(date +%H:%M)"} | |
| # make sure we're at the root of git repo | |
| #if [ ! -d .git ]; then | |
| # echo "Error: must run this script from the root of a git repository" | |
| # exit 1 | |
| #fi |
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
| #!/bin/bash | |
| # make sure we're at the root of git repo | |
| if [ ! -d .git ]; then | |
| echo "Error: must run this script from the root of a git repository" | |
| exit 1 | |
| fi | |
| git diff --numstat \ | |
| | awk '{if (($1 == "-" && $2 == "-") || ($1 == "0" && $2 == "0")) { $1=$2=""; print }}' \ |
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
| # | |
| # Given a bit of program logic: | |
| # | |
| # x2 = y1 * x1 || y2 / exchange_rate || x2 * exchange_rate / y1 || another | |
| # | |
| # Where y1, x1, y2 and x2 are function calls, which may yield nils | |
| # | |
| def coalesce(*args) |
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
| # | |
| # | |
| # Rails 4 concern for specifying default attribute values on models | |
| # | |
| # E.g. The following user has defaults defined for `active` and `manager` attributes | |
| # | |
| # class User < ActiveRecord::Base | |
| # include Concerns::DefaultValues | |
| # | |
| # default_value :active, true |