This file contains 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
# app/controllers/application_controller.rb | |
# Base controller for a Rails app integrated with Heroku Autoscaler. | |
# Tracks web response times and stores them in Redis for autoscaling decisions. | |
# Usage: Works with Heroku::Autoscaler to scale the 'web' dyno based on average response time. | |
# Requirements: 'redis' gem, REDIS_URL env variable set (e.g., via Heroku Redis add-on). | |
require 'json' | |
class ApplicationController < ActionController::Base | |
# Hook to measure response time for every action in the app |
This file contains 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
/*https://gamepadviewer.com/?p=1&css=https%3A%2F%2Fgistcdn.githack.com%2FMakarovCode%2F252a177ccf619fb8fee5777ca89ec413%2Fraw%2Fa9d7fdb329f7cc82c8c954e428983dcf037f14df%2Fgamepadviewer-n64.css&map=%7B%22mapping%22%3A%5B%7B%22targetType%22%3A%22buttons%22%2C%22target%22%3A%229%22%2C%22disabled%22%3Afalse%2C%22choiceType%22%3A%22buttons%22%2C%22choice%22%3A%220%22%7D%2C%7B%22targetType%22%3A%22buttons%22%2C%22target%22%3A%228%22%2C%22disabled%22%3Afalse%2C%22choiceType%22%3A%22buttons%22%2C%22choice%22%3A%222%22%7D%2C%7B%22targetType%22%3A%22buttons%22%2C%22target%22%3A%2216%22%2C%22disabled%22%3Afalse%2C%22choiceType%22%3A%22buttons%22%2C%22choice%22%3A%229%22%7D%2C%7B%22targetType%22%3A%22buttons%22%2C%22target%22%3A%220%22%2C%22disabled%22%3Afalse%2C%22choiceOperand%22%3A%22-%22%2C%22choiceType%22%3A%22axes%22%2C%22choice%22%3A%223%22%7D%2C%7B%22targetType%22%3A%22buttons%22%2C%22target%22%3A%223%22%2C%22disabled%22%3Afalse%2C%22choiceOperand%22%3A%22%2B%22%2C%22choiceType%22%3A%22axes%22%2C%22choice%22%3A%2 |
This file contains 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 "mini_magick" | |
class AsciiArt | |
attr_accessor :path, :inverted, :size, :art | |
# Make sure size is in this format 100x100 or 50x600 | |
def initialize(path, inverted=nil, size=nil) | |
@path = path | |
@inverted = inverted |
This file contains 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
[Unit] | |
Description=gps_client | |
After=syslog.target network.target | |
[Service] | |
Type=simple | |
WorkingDirectory=/home/ubuntu/motosmart/current/lib | |
ExecStart=ruby /home/ubuntu/motosmart/current/lib/ruby_script.rb |
This file contains 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
[Unit] | |
Description=sidekiq | |
After=syslog.target network.target | |
[Service] | |
Type=simple | |
WorkingDirectory=/home/rails/project/current | |
ExecStart=/home/rails/.rbenv/shims/bundle exec sidekiq -e production -L /home/rails/project/current/log/sidekiq.log |
This file contains 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
## | |
# You should look at the following URL's in order to grasp a solid understanding | |
# of Nginx configuration files in order to fully unleash the power of Nginx. | |
# http://wiki.nginx.org/Pitfalls | |
# http://wiki.nginx.org/QuickStart | |
# http://wiki.nginx.org/Configuration | |
# | |
# Generally, you will want to move this file somewhere, and start with a clean | |
# file but keep this around for reference. Or just disable in sites-enabled. | |
# |
This file contains 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
var module = angular.module('app', []) | |
//Just add this after you declare your main module | |
module.filter('decimalmax', ['$filter', function ($filter) { | |
return function(num, params) { | |
if (num == null) return 0; | |
var v = (num + "").split("."); | |
var pres = 0 | |
if (v.length > 1){ | |
var p = v[1].length; | |
if (p <= params){ |