Skip to content

Instantly share code, notes, and snippets.

@Hailong
Hailong / makeapp.sh
Last active August 29, 2015 14:26 — forked from demonbane/makeapp.sh
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
@Hailong
Hailong / README.md
Last active August 29, 2015 14:27 — forked from nicerobot/README.md
Mac OS X uninstall script for packaged install of node.js

To run this, you can try:

curl -ks https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh | bash

I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this one'll work too.

Alternatively,

curl -ksO https://gist.github.com/nicerobot/2697848/raw/uninstall-node.sh

chmod +x ./uninstall-node.sh

@Hailong
Hailong / default.vcl
Last active July 9, 2022 10:41
Varnish 4 VCL for Prestashop 1.6 (*** This is still under development, don't use it directly! ***)
#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.
@Hailong
Hailong / gist:c705a490d6e1eb31f3402bb19286a16a
Created November 22, 2016 06:10
Set up Mautic dev environment quickly.
#!/bin/bash
# 1. Check out the latest code from https://github.com/mautic/mautic
# 2. Run 'composer install' in the root directory as described in the README file.
# 3. Run the following script to set the folder permissions correctly. NOTE: change the "my_linux_account" and "web_daemon_account" properly according your sever.
my_linux_account="root"
web_daemon_account="apache"
@Hailong
Hailong / gist:2f0b4dfc983dab2b73358716eb7d1220
Created September 6, 2017 18:34 — forked from elebescond/gist:1433137
Generate a pot template from a wordpress theme - xgettext
find . -iname "*.php" > /tmp/my_theme_file_list.txt
# new template
xgettext --from-code=utf-8 -d my_theme -f /tmp/my_theme_file_list.txt --keyword=__ -o languages/my_theme.pot
# update template
xgettext --from-code=utf-8 -d my_theme -j -f /tmp/my_theme_file_list.txt --keyword=__ -o languages/my_theme.pot
@Hailong
Hailong / 000 - Magento .gitignore
Created December 11, 2018 03:27 — forked from dfelton/000 - Magento .gitignore
.gitignore for Magento 1.9 projects
##
# Magento stuff.
##
downloader/.cache/*
downloader/cache.cfg
downloader/connect.cfg
maintenance.flag
media/*
media/**
var/*
@Hailong
Hailong / Index.php
Last active November 25, 2020 01:23
Fix ShipStation plugin for Magento 2.3
<?php
namespace Auctane\Api\Controller\Auctane;
use Exception;
use Magento\Framework\App\CsrfAwareActionInterface;
use Magento\Framework\App\Request\InvalidRequestException;
use Magento\Framework\App\RequestInterface;
class Index extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface
{
@Hailong
Hailong / my.cnf
Created June 29, 2019 01:47 — forked from kenelliott/my.cnf
16CPU / 16GB My.cnf
[mysqld_safe]
nice = -15
[mysqld]
max_binlog_size = 256M #max size for binlog before rolling
expire_logs_days = 1 #binlog files older than this will be purged
## Per-Thread Buffers * (max_connections) = total per-thread mem usage
thread_stack = 256K #default: 32bit: 192K, 64bit: 256K
sort_buffer_size = 1M #default: 2M, larger may cause perf issues
@Hailong
Hailong / robots.txt
Created September 5, 2019 17:14 — forked from hn-support/robots.txt
Magento 2 recommended additions for robots.txt
User-agent: *
# Directories
Disallow: /app/
Disallow: /bin/
Disallow: /dev/
Disallow: /lib/
Disallow: /phpserver/
Disallow: /pkginfo/
Disallow: /report/
@Hailong
Hailong / randomness.php
Created November 27, 2019 14:03
Randomness distribution test of different random functions
#!/usr/bin/env php
<?php
/**
* Randomness distribution test of different random functions
*/
$counters = [
'array_rand' => [],
'random_int' => [],