Skip to content

Instantly share code, notes, and snippets.

Augusts Bautra Epigene

Block or report user

Report or block Epigene

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
@operatino
operatino / MySQL_5-7_macOS.md
Last active Nov 11, 2019 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL 5.7 on macOS using Homebrew
View MySQL_5-7_macOS.md

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@rwarbelow
rwarbelow / running_app_in_production_locally.markdown
Created Nov 11, 2015
How to Run a Rails App in Production Locally
View running_app_in_production_locally.markdown
  1. Add gem 'rails_12factor' to your Gemfile. This will add error logging and the ability for your app to serve static assets.
  2. bundle
  3. Run RAILS_ENV=production rake db:create db:migrate db:seed
  4. Run rake secret and copy the output
  5. From the command line: export SECRET_KEY_BASE=output-of-rake-secret
  6. To precompile your assets, run rake assets:precompile. This will create a folder public/assets that contains all of your assets.
  7. Run RAILS_ENV=production rails s and you should see your app.

Remember to clobber your assets (rake assets:clobber) and re-precompile (rake assets:precompile) if you make changes.

View gist:903a7237b9d36388c867
#!/usr/bin/env ruby
# Usage: paste in a file and call it in console with `ruby filename`
# inicializē datu struktūras
musejie = []
`rm out.csv` ; `touch out.csv`
#ielasa no faila pasaucot shell command
musejie = `cat musejie.csv`.split.uniq # musejie.csv satur ierakstus katru jaunā rindiņā caur kuriem laist ciklu
@kyletcarlson
kyletcarlson / json_response_handling_ruby.rb
Created Dec 11, 2013
Ruby script that uses open-uri to fetch the contents of a JSON endpoint, uses the JSON gem to parse the string into a Ruby array & prints some of the records. This is the foundation for all web API requests, so feel free to use it in the future.
View json_response_handling_ruby.rb
# http://ruby-doc.org/stdlib-2.0.0/libdoc/open-uri/rdoc/OpenURI.html
require 'open-uri'
# https://github.com/flori/json
require 'json'
# http://stackoverflow.com/questions/9008847/what-is-difference-between-p-and-pp
require 'pp'
# Construct the URL we'll be calling
request_uri = 'http://localhost:3000/users.json'
request_query = ''
@p1nox
p1nox / postgresql_configuration_on_ubuntu_for_rails.md
Last active Nov 11, 2019
PostgreSQL configuration without password on Ubuntu for Rails
View postgresql_configuration_on_ubuntu_for_rails.md

Abstract

You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.

Install Postgre packages

  • postgresql
  • postgresql-client
  • libpq-dev
@garyharan
garyharan / dot_pryrc
Created Jun 18, 2012
Awesome Print + Pry == Awesome Pry
View dot_pryrc
require "rubygems"
require "awesome_print"
Pry.print = proc { |output, value| output.puts value.ai }
@nhocki
nhocki / colors.rb
Created Nov 30, 2011
Colorize the output of your ruby rake tasks
View colors.rb
module Colors
def colorize(text, color_code)
"\033[#{color_code}m#{text}\033[0m"
end
{
:black => 30,
:red => 31,
:green => 32,
:yellow => 33,
@thomd
thomd / ssh-host-color.sh
Created May 4, 2011 — forked from pol/set_iTerm_background.sh
set the background color of iTerm based on ssh-host
View ssh-host-color.sh
#!/bin/bash
#
# (1) copy to: ~/bin/ssh-host-color
# (2) set: alias ssh=~/bin/ssh-host-color
#
# Inspired from http://talkfast.org/2011/01/10/ssh-host-color
# Fork from https://gist.github.com/773849
#
set_term_bgcolor(){
You can’t perform that action at this time.