Skip to content

Instantly share code, notes, and snippets.

View lucdkny's full-sized avatar

Luke Tran lucdkny

  • Solis Lab
  • Ha Noi, VN
View GitHub Profile
@lucdkny
lucdkny / MAMP PRO 4 Trial Reset.md
Created November 11, 2019 14:10 — forked from mdjaman/MAMP PRO 4 Trial Reset.md
MAMP PRO 4 Trial Reset

MAMP PRO 4 Trial Reset

A simple script that resets latest MAMP PRO 4 trial validity, and keeps your data safe.

How to use

  • Copy the code into a file OR download the script and save it as reset_mamp4.sh
  • Open the Terminal app and write chmod +x then drag and drop the file on the Terminal. You should have something like chmod +x reset_mamp4.sh. Press Enter to run it.
  • Now, run the file itself by dragging and dropping it on the Terminal (something like reset_mamp4.sh) then pressing Enter.
  • Open MAMP PRO and check if you have 14 days left now.

Didn't work?

@lucdkny
lucdkny / config.ru
Created May 3, 2019 17:10 — forked from nathany/config.ru
Magical Unicorn Configuration for Heroku
# add something like this to config.ru
# see https://github.com/kzk/unicorn-worker-killer
if Integer(ENV['UNICORN_KILLER'] || 0) != 0
require 'unicorn/worker_killer'
# Max memory size (RSS) per worker
use Unicorn::WorkerKiller::Oom, (350*(1024**2)), (400*(1024**2)), 30, true
end
# Insomnia Configuration
## Run the test query
{
shop {
id
name
}
}
# Query Structure Examples
@lucdkny
lucdkny / README.md
Created October 31, 2018 16:28 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@lucdkny
lucdkny / sticky.js
Created October 30, 2018 07:24 — forked from javierarques/sticky.js
Sticky Sideabr With Vanilla Javascript. Detects scroll and set fixed the element. Live example: http://codepen.io/javiarques/pen/vKdgjR
// Sticky Nav Component
var Sticky = (function() {
'use strict';
var CSS_CLASS_ACTIVE = 'is-fixed';
var Sticky = {
element: null,
position: 0,
addEvents: function() {
@lucdkny
lucdkny / Shopify-Checkout-Hack.js
Created March 1, 2018 17:49 — forked from cvieth/Shopify-Checkout-Hack.js
Shopify Checkout Hack - This scipt helps to modify the Shopify Checkout Pages
/**
* Shopify Checkout Hack
*
* This scipt helps to modify the Shopify Checkout Pages. To run this script, add your
* code for each checkout step, compress your code with a tool of your choice and paste
* it to:
*
* Admin > General > Google Analytics > Additional Google Analytics Javascript
*
* @author Christoph Vieth <christoph@vieth.me>
@lucdkny
lucdkny / index.md
Created September 30, 2017 20:47 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@lucdkny
lucdkny / php-regex-meta-description.php
Created October 5, 2016 02:59
How to PHP regex match an HTML document's meta description
<?php
function parseDescription($html) {
// Get the 'content' attribute value in a <meta name="description" ... />
$matches = array();
// Search for <meta name="description" content="Buy my stuff" />
preg_match('/<meta.*?name=("|\')description("|\').*?content=("|\')(.*?)("|\')/i', $html, $matches);
if (count($matches) > 4) {
return trim($matches[4]);
}
@lucdkny
lucdkny / shopify-authentification-flow.md
Created September 12, 2016 19:49 — forked from lbdremy/shopify-authentification-flow.md
Shopify authentification flow

Shopify authentification flow

Request URL:http://www.retailtower.com/app/settings/shopify.php?shop=retailer-lambda.myshopify.com&signature=1fa9c810fec17eea99b04ef21204c91b&timestamp=1370278389
Request Method:GET
Status Code:302 Moved Temporarily

Request Headers

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
@lucdkny
lucdkny / javascript-query-string.js
Created August 28, 2016 08:20 — forked from DavidWells/javascript-query-string.js
JavaScript :: Regex trick: Parse a query string into an object
// http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
// JavaScript regex trick: Parse a query string into an object
var queryString = {};
anchor.href.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) { queryString[$1] = $3; }
);
// Usage