Skip to content

Instantly share code, notes, and snippets.

View gmrdad82's full-sized avatar
🎮
Gaming

Catalin Ilinca gmrdad82

🎮
Gaming
  • Castellon de la Plana, Spain
  • 22:06 (UTC +02:00)
  • YouTube @GmrDad82
View GitHub Profile
@gmrdad82
gmrdad82 / sidekiq-worker-cloudwatch-queue-size.rb
Created March 28, 2017 16:46 — forked from jwicks/sidekiq-worker-cloudwatch-queue-size.rb
Sidekiq worker for publishing queue size metric to AWS CloudWatch
class QueueSizeMetricWorker
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence { minutely }
sidekiq_options retry: false
# Publish a custom metric on CloudWatch with the Sidekiq queue size
def perform
cloudwatch = Aws::CloudWatch::Client.new(
@gmrdad82
gmrdad82 / gist:64ed550e5f8a7297625fa9073ffb5334
Created March 2, 2017 18:59 — forked from mikesprague/gist:5881937
AWS: Bucket Policy Example (Allow Get by Referer)
{
"Version": "2008-10-17",
"Id": "http referer policy example",
"Statement": [
{
"Sid": "Allow get requests from certain domains (including local development)",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket-name-here/*",
# Copy and paste this to the rails console to test your email settings
class MyMailer < ActionMailer::Base
def test_email
@recipients = "[email protected]"
@from = "[email protected]"
@subject = "test from the Rails Console"
@body = "This is a test email"
end
end
@gmrdad82
gmrdad82 / xp-bar.lua
Created August 30, 2016 01:49
XP Bar
duKzlaGivfxIIIrHOCkeXQqOsZsQKUfK0UOO0VuHuddsDmHAzsfptvvtdIUgczBksFtfmofvNtfQ5Pi4GkcTqvL6HqctuQeUOuPSrffNufcwjL6LsLiZeHkUPIs7KI8tekdfr1srOQNIAQICvvL8vvizSkIMRkeAVK)cHbljhwHftr1JPWKvLlt1MLuFMsgTQkNwPvlvQETkenBOUTq2Te)wkdxQA5i9CvA6GRly7QOVdjA8isNhbRxQe1(f1kwjXdLei(kUJz7y2yZ(xCK4N4NsIF7T7HIbSNU4bglEya7PNORLLtNT9Czc1y0IDs7hLN)K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XFsAGZ004dldH(uXv(OrhY(CcbK30ZdWgZgmRqiaMb7lalUPAzEdw)cxtYGvgOFN9IYiGfT01gWkgEUPU3sWAcJEVgTpZFg4DHLji807SmVbs(Orhsr4ceScVOr0Si0NkGL59WABjx5JgDifH8NWIIr54edcWZ0j5YDW4CtoXhJZCZzmgtaottNgwVJjaxyjMpSeCHnP5PhUabeSnXWaINjkcMbRKHeWf2KMNE4ceqWosniMpSeCHnP5PhUabeSCme6Dw4cBsZtpCbciyLoFaxytAE6HlqabRWZX9inpHcCHnP5PhUabeqablcCH8NWfwoNL2VFhqE8NaRWlo8muUXmcwmJGzyrAIKl5gZiy5Awe6D2SYu70slT0650Y6iTMpMioj9CmekJEA)yeczLPweFHv70slT0slT0slzqnPvluFa19QDAPLwAfwbTtlT0slTtlT0sRSnGtsphdHWepufug90(XieWjPNJHq8SCoTmPwzBaNKEogcHjEZdvbLrpTFmcbCs65yieplNRxTtlT0slTtlT0slVdH516PiHh)y1I5jEuKWJFSAzzjbwTEeNfRwKJyEZnfRwd3BjXDewcRw90y(NqbRwmj9Cmec3yemjZIe84hRwSXiysMfj6ZjWJFSA9uKGBmcMKzrcE8JvlMN4rrcUXiysMfj4XpwTyEYO2RBOLj1kB
(function() {
var weekday = function() {
var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
now = new Date();
return dayNames[now.getDay()];
};
console && console.log('%crangeslider.js\n%cSimple, small and fast JavaScript/jQuery polyfill\nfor the HTML5 <input type=\"range\"> slider element. \n\nThanks for taking a look :)\nIt\'s always nice to see you.\nHave a nice ' + weekday() + '!\n\n<3\n\nAndré', 'font-size:2em;color:#00ff00;', 'color:#404040;font-size:1em;');
})();
// from: http://rangeslider.js.org/
@gmrdad82
gmrdad82 / input-group-in-simple-form.md
Created March 6, 2016 18:55 — forked from chunlea/input-group-in-simple-form.md
How to use Boostrap 3 input-group in Simple Form

Finally, Simple Form support Boostrap 3. 👏

But I found it still dosen't support some components in Bootstrap 3. Or may be in the future. But I can't wait, so I find a solution to support them. It was inspired by heartcombo/simple_form#531 (comment) .

This is a final solution and I used in my project.

simple_form

@gmrdad82
gmrdad82 / rails_bootstrap_delete_confirmation_modal.md
Created February 21, 2016 15:24 — forked from postpostmodern/rails_bootstrap_delete_confirmation_modal.md
A nice delete confirmation modal in Rails courtesy of Bootstrap

Here's what you get.

Some CoffeeScript (verbosely commented for clarity)

# Override Rails handling of confirmation

$.rails.allowAction = (element) ->
  # The message is something like "Are you sure?"
  message = element.data('confirm')
# This method is heavily adapted from the Rails method of determining the subdomain.
require 'rubygems'
require 'sinatra'
require 'rack/request'
# We re-open the request class to add the subdomains method
module Rack
class Request
def subdomains(tld_len=1) # we set tld_len to 1, use 2 for co.uk or similar
@gmrdad82
gmrdad82 / tmux-cheatsheet.markdown
Created October 29, 2015 09:33 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname