Skip to content

Instantly share code, notes, and snippets.

@sutanto
sutanto / install_curb_0.9.3_on_macos_catalina.sh
Last active October 19, 2020 05:27
Install curb 0.9.3 on MacOS Catalina
# You'll probably also need to Install Ruby 2.3.x with OpenSSL 1.0 (on Catalina),
# follow this gist *before* you install curb: https://gist.github.com/sutanto/75a778f94edae116aeaa5ec56955ce58
# Recent Homebrew version no longer allow the `brew install formula` command, we'll need to create our own "custom" tap:
brew tap-new sutanto/homebrew-versions
# make sure that we don't use the "shallow" local homebrew repo
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow
# extract the required curl version

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
@alexey
alexey / README_AA_CC_AASM.md
Last active August 7, 2020 08:34
ActiveAdmin + CanCan + AASM event switcher with AJAX

About:

Inspired by activeadmin_addons and its Enum Integration I want to make similar functionality for AASM by letting users change events depending on their abilities and available events/statuses in model.

Sorry i have no time to create an addon right now for this gem but i will try to do it soon. Feel free to modify, use it and integrate. Ask me any question if you need!

Prequestites:

Gem: ActiveAdmin,

##### Email Opens:
### Event Test Endpoint:
https://ga-dev-tools.appspot.com/hit-builder/
### Creating GA query properties:
Unique Member ID, Message ID, Message Network & Message Content
From Admin > Custom Definitions > Custom Dimension(order sensitive), create these properties as dimensions(see article https://support.google.com/analytics/answer/2709829)
The resultant properties with the the keys: cd1, cd2, cd3 & cd4. These will be used in the event hit.
@canhnht
canhnht / bash_aliases.sh
Last active June 13, 2018 22:31
Set color bash prompt according to active virtualenv, git branch and return status of last command.
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
@wakproductions
wakproductions / sidekiq_cheat_sheet.md
Last active March 18, 2024 14:08
Sidekiq Commands Cheat Sheet
@gtmax
gtmax / symbol_call_patch.rb
Last active April 21, 2016 09:02
Symbol Monkeypatch to allow passing params to &
class Symbol
# Allows to pass args to &:method_name like so:
# [1.234, 2.345, 3.456].map &:round.(2) => [1.23, 2.34, 3.45]
def call(*args)
proc do |receiver|
receiver.send(self, *args)
end
end
end
@pcm211
pcm211 / Deploying on Amazon AWS (Free-Tier) with EC2, RDS & S3.md
Last active August 12, 2023 21:09
This Is a step by step way to deploy Sharetribe to Amazon AWS Free Tier in Development Mode (Not Production)

Prerequisites

  1. Have an AWS Account
  2. Spin up an EC2 Instance of Ubuntu Server and Make sure that your instance's security groups allow incoming connections on TCP ports 22 and 3000
  3. Use an Elastic IP to bind your Instance to it --- You would not be paying for this -- Till the time the EC2 Instance is running
  4. Add the IP Allocated to your A Record --- with your registrar
  5. Have a SSH Connection to your EC2 Instance with the Key Pairs
  6. Connect to the EC2 Instance

STEP 1 -- Setting up the Playground

@wvengen
wvengen / README.md
Last active March 25, 2024 07:53
Ruby memory analysis over time

Finding a Ruby memory leak using a time analysis

When developing a program in Ruby, you may sometimes encounter a memory leak. For a while now, Ruby has a facility to gather information about what objects are laying around: ObjectSpace.

There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the

@jakimowicz
jakimowicz / the % notation in ruby.md
Last active April 4, 2024 13:59
%Q, %q, %W, %w, %x, %r, %s, %I, %i

%Q, %q, %W, %w, %x, %r, %s, %i

Perl-inspired notation to quote strings: by using % (percent character) and specifying a delimiting character.

Any single non-alpha-numeric character can be used as the delimiter, %[including these], %?or these?, %~or even these things~.

Strings

% or %Q