Skip to content

Instantly share code, notes, and snippets.

@fixable11
fixable11 / comment-example.js
Created November 27, 2021 13:54 — forked from nikes/comment-example.js
Dynamoose range and hash key example
var commentSchema = new Schema({
postId: {
type: String,
hashKey: true
},
id: {
type: String,
rangeKey: true,
default: shortId.generate
@fixable11
fixable11 / gist:3831c6d698cb2b6e49e4e0ccdfbf455f
Created October 14, 2020 14:54
Laravel supervisor conf horizon /etc/supervisor/conf.d/horizon.conf
[program:horizon]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/ub-admin-client/artisan horizon
autostart=true
autorestart=true
user=fixable
startsecs = 0
redirect_stderr=true
stdout_logfile=/var/www/ub-admin-client/storage/logs/horizon.log
stopwaitsecs=3600
before_script:
- echo 'Before script'
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- chmod 700 ~/.ssh
- ssh-keyscan -H 'domain.com' >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
building:
<?php
namespace App\Traits;
trait FullTextSearch
{
/**
* Replaces spaces with full text search wildcards
*
* @param string $term

#Yii2 basic htaccess

Demo

Video Demo

Video Demo

a. Automatic setting index.php

This method created .htaccess files automatically and clear self.

$(function() {
var $window = $(window);
var $sidebar = $(".sidebar");
var $sidebarTop = $sidebar.position().top;
var $sidebarHeight = $sidebar.height();
var $footer = $('.footer');
var $footerTop = $footer.position().top;
$window.scroll(function(event) {
$sidebar.addClass("fixed");
function curl_get($url, $referer = 'https://www.google.com'){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36');
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
return $data;
@fixable11
fixable11 / LocalDate
Created August 12, 2018 15:34
Translates UTC timestamp to local date
//Translates UTC timestamp to local date
function newDate($selector){
var $UTCtimestamp = $($selector).data('timestamp');
var $localData = new Date($UTCtimestamp * 1000);
var $date = "0" + $localData.getDate();
var $mount = "0" + ($localData.getMonth() + 1);
var $year = $localData.getFullYear();
var $hours = $localData.getHours();
https://mlocati.github.io/articles/php-windows-imagick.html
https://ourcodeworld.com/articles/read/349/how-to-install-and-enable-the-imagick-extension-in-xampp-for-windows
//check if the first node is an element node
function get_firstChild(n) {
var y = n.firstChild;
while (y.nodeType != 1) {
y = y.nextSibling;
}
return y;
}