Skip to content

Instantly share code, notes, and snippets.

antarr antarr

Block or report user

Report or block antarr

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
antarr / activeadmin.rb
Last active Jul 31, 2019
Active Admin Version Panel
View activeadmin.rb
# lib/ext/activeadmin.rb
module ActiveAdminPaperTrailDetails
def versions
panel 'Versions', class: 'versions' do
table_for resource.versions.order :created_at do
column(:whodunnit) { |v| auto_link User.find_by(id: v.whodunnit) }
column :event
column 'When', :created_at
column 'Changes' do |v|
attributes_table_for v.changeset.to_a do
View measurements_controller.rb
class Api::MeasurementsController < ApplicationController
def index
measurements = Measurement.all
render json: measurements
def create
if measurement = Measurement.create measurement_params
antarr / error.txt
Last active Nov 8, 2018
using factory_bot traits
View error.txt
FactoryBot::AssociationDefinitionError: Self-referencing association 'notification_eventable' in 'property'
chef gem install knife-solo
knife solo init sonar && cd sonar
knife solo prepare antarrbyrd@
knife solo bootstrap antarrbyrd@
knife solo cook antarrbyrd@
antarr / gist:108cc0f083a6b8648fe0d0dcfcaeec44
Last active Mar 14, 2017
Installing SonarQube + Mysql + Caddy
View gist:108cc0f083a6b8648fe0d0dcfcaeec44
# Install MySql then Sonar
sudo apt-get -y update
sudo apt-get install mysql-server
# Connect to MySql
mysql -u root -p
antarr / application_controller.rb
Last active Feb 9, 2017
has_secure_token example
View application_controller.rb
# app/controllers/application_controller.rb
class ApplicationController < ActionController::API
before_action :authenticate
def render_unauthorized(status: 401, message: 'Unauthorized')
render json: { errors: Array.wrap(message).map { |msg| { status: status, title: msg } } }, status: status
antarr / Dockerfile
Last active Nov 23, 2015
CentOS 6.6 with Ruby 2.2.3
View Dockerfile
FROM centos:6.6
RUN yum update -y
RUN yum install git openssl-devel openssh-server sudo openssl readline-devel readline zlib-devel zlib libxml2-devel libxml2 libxslt-devel libxslt nginx tar gcc libaio libaio-devel -y
RUN rpm -Uvh
RUN sed -i -e "s/Defaults requiretty.*/ #Defaults requiretty/g" /etc/sudoers
RUN mkdir -p /var/run/sshd
RUN useradd -m -u 1000 -G wheel deploy && echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/wheel
antarr / Sum of Integer
Created Nov 7, 2014
Write a program to determine the largest sum of contiguous integers in a list.
View Sum of Integer
def largestSum(ns: List[Int]): Int ={
def sum(numbers: List[Int]) = numbers.foldLeft(0)((a,b) => a+ b)
@tailrec def loop(numbers: List[Int], large: Int): Int = numbers match{
case Nil => large
case _ => {
val thisSum = sum(numbers)
if(thisSum > large)
loop(numbers.tail, thisSum)
View MainWindow.xaml
<Window x:Class="TicTacToe.MainWindow"
Title="Tic-Tac-Toe" Height="378.388" Width="476.493">
<Grid VerticalAlignment="Top" ShowGridLines="True" Height="336" Margin="10,10,2,-20">
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
View MainWindow.xaml.cs
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace TicTacToe
/// <summary>
/// Author: Antarr Byrd
/// When: Fall 2012
/// Where: Texas Southern Univeristy
You can’t perform that action at this time.