Skip to content

Instantly share code, notes, and snippets.

@aldrienht
aldrienht / gist:cdedca54a9398bdc6f7a3e12d7a222db
Last active August 5, 2016 02:52
Matching System Font with your local environment and Amazon Linux
Step 1: Back up your EC2 System fonts.
cp -r /etc/fonts /etc/fonts.old
Step 2: Migrate your local font via SCP.
scp -r -i file.pem /etc/fonts ec2-user@ec2-x-x-x-x.ap-northeast-1.compute.amazonaws.com:/etc/fonts
Step 3: Reset Font Cache
fc-cache
fc-cache -v | grep err (to check errors)
@aldrienht
aldrienht / gist:f31967e6eba4088324088df55e03a271
Created December 7, 2016 08:01
Simple Dynamin Morris Bar Chart - Rails
// JS Code
// Assumed that you already declared libraries needed.
$.ajax({
type: "GET",
dataType: 'json',
url: "/en/project_chart", // This is the URL to the API
})
.done(function( data ) {
if ((typeof data === "undefined" || data === null) || data.length === 0) {
@aldrienht
aldrienht / testing_wicked_pdf_with_cucumber
Created October 4, 2017 11:23
Testing With Cucumber and Wicked PDF
#Step-Definition
require 'tempfile'
Then(/^I follow the PDF link "([^"]*)"$/) do |text|
find("a[title='#{text}']").click
temp_pdf = Tempfile.new('pdf')
if Capybara.current_driver == Capybara.javascript_driver
temp_pdf << page.driver.source.force_encoding('UTF-8')
else
temp_pdf << page.driver.response.body.force_encoding('UTF-8')
@aldrienht
aldrienht / checkout_params.txt
Last active October 11, 2021 05:36
App Metrics Checkout Parameters
{
"shop_id" => 40718008476,
"name" => "direct_checkout",
"checkout_item" => [
{
"variant_id" => 34839683891356,
"quantity" => 1,
"product_id" => 5340830433436,
"final_price" => 140050,
"handle" => "basketball-spalding-x2",
@aldrienht
aldrienht / gist:08d68f99cb7f409f3f47c10bcbf6ccd2
Last active November 4, 2021 04:38
Deleted VIP Rewards by passionco.myshopify.com
RewardName, CreatedAt, DeletedAt
[
["12% off coupon", Mon, 01 Nov 2021 02:14:11.508067000 UTC +00:00, Tue, 02 Nov 2021 02:10:44.043324000 UTC +00:00],
["15% off coupon", Mon, 01 Nov 2021 02:15:18.556228000 UTC +00:00, Tue, 02 Nov 2021 02:10:53.910628000 UTC +00:00],
["10% off coupon", Tue, 28 Sep 2021 07:16:05.306065000 UTC +00:00, Tue, 02 Nov 2021 02:10:24.194433000 UTC +00:00],
["$5 off coupon", Mon, 01 Nov 2021 02:17:22.734393000 UTC +00:00, Wed, 03 Nov 2021 09:32:32.672410000 UTC +00:00],
["$10 Off Coupon", Tue, 02 Nov 2021 05:29:50.660765000 UTC +00:00, Wed, 03 Nov 2021 09:38:33.776451000 UTC +00:00],
["Free (LIMITED TIME) Click Frenzy Special - FREE Earrings! coupon", Tue, 26 Oct 2021 06:57:28.118066000 UTC +00:00, Tue, 26 Oct 2021 07:11:54.183801000 UTC +00:00],
["Free BrilliantCo Gift Card coupon", Tue, 26 Oct 2021 07:05:27.646616000 UTC +00:00, Tue, 02 Nov 2021 05:34:32.670704000 UTC +00:00],
@aldrienht
aldrienht / get_reviews.rb
Last active May 13, 2022 08:30
Get Reviews from JudgeMe
# Install JudgeMe app
# Get Judge.me API crendentials as below:
private_token = "b_UmJknnxEONTwVDs-E2ARZtVzA
shop_domain = "msg-app-store.myshopify.com"
RestClient.get(
"https://judge.me/api/v1/reviews",
params: {
api_token: private_token,
@aldrienht
aldrienht / display_points_amount.js
Last active November 30, 2022 10:26
Display points amount on product page
{% if template.name == 'product' %}
<script>
document.addEventListener('readystatechange', event => {
if (event.target.readyState === "complete") {
const orderPlacedSettings = window.BoosterApps.loy_config.ways_to_earn.filter(function(w) { return w.trigger === "order_placed" })[0];
if(!orderPlacedSettings || !window.BoosterApps?.common?.product){
return;
}
const brandThemeSettings = window.BoosterApps.loy_config.brand_theme_settings;