Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jared Chu jaredchu

🏠
Working from home
View GitHub Profile
View location.js
var results = [];
$('#speedtest_v4 tr').each(function (){
var i = 0;
var name;
var ip;
var link100;
var link1000;
$(this).find('td').each(function (){
switch(i) {
case 0:
@jaredchu
jaredchu / Save.php
Last active Mar 14, 2020
app/code/Amasty/Feed/Controller/Adminhtml/Feed/Save.php
View Save.php
<?php
/**
* @author Amasty Team
* @copyright Copyright (c) 2019 Amasty (https://www.amasty.com)
* @package Amasty_Feed
*/
namespace Amasty\Feed\Controller\Adminhtml\Feed;
View m2zoomooz.min.js
require(['jquery'], function($){ function Matrix(){}var Sylvester={version:"0.1.3",precision:1e-6};Matrix.prototype={dup:function(){return Matrix.create(this.elements)},canMultiplyFromLeft:function(e){var t=e.elements||e;return t[0][0]===void 0&&(t=Matrix.create(t).elements),this.elements[0].length==t.length},multiply:function(e){var t=e.modulus?!0:!1,n=e.elements||e;if(n[0][0]===void 0&&(n=Matrix.create(n).elements),!this.canMultiplyFromLeft(n))return null;var r,o,a,i,s,l,u=this.elements.length,c=u,f=n[0].length,m=this.elements[0].length,d=[];do{r=c-u,d[r]=[],o=f;do{a=f-o,i=0,s=m;do l=m-s,i+=this.elements[r][l]*n[l][a];while(--s);d[r][a]=i}while(--o)}while(--u);return n=Matrix.create(d),t?n.col(1):n},isSquare:function(){return this.elements.length==this.elements[0].length},toRightTriangular:function(){var e,t,n,r,o=this.dup(),a=this.elements.length,i=a,s=this.elements[0].length;do{if(t=i-a,0===o.elements[t][t])for(j=t+1;i>j;j++)if(0!==o.elements[j][t]){e=[],n=s;do r=s-n,e.push(o.elements[t][r]+o.elements[j][
View node start
#!/bin/sh
### BEGIN INIT INFO
# Provides: ProviderName
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: false
# Short-Description: Short description
# Description: Long Description
@jaredchu
jaredchu / Input
Last active Jun 8, 2018
Convert flat tree to tree
View Input
[
[
'id' => 1,
'name_lv1' => 'Parent0',
'name_lv2' => null,
'name_lv3' => null,
'name_lv4' => null,
'name_lv5' => null,
],
[
View single.php
the_reverse_post_navigation( array(
'prev_text' => '<span class="screen-reader-text">' . __( 'Previous Post', 'twentyseventeen' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . __( 'Previous', 'twentyseventeen' ) . '</span> <span class="nav-title"><span class="nav-title-icon-wrapper">' . twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '</span>%title</span>',
'next_text' => '<span class="screen-reader-text">' . __( 'Next Post', 'twentyseventeen' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . __( 'Next', 'twentyseventeen' ) . '</span> <span class="nav-title">%title<span class="nav-title-icon-wrapper">' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ) . '</span></span>',
) );
View array-rotate-php
<?php
$handle = fopen ("php://stdin","r");
fscanf($handle,"%d %d",$n,$k);
$a_temp = fgets($handle);
$a = explode(" ",$a_temp);
array_walk($a,'intval');
function rotate_left($arr, $k){
$left = array_reverse(array_slice($arr,0,$k));
@jaredchu
jaredchu / Node.php
Last active Aug 31, 2017
Binary Search Tree example in PHP
View Node.php
<?php
/**
* Created by PhpStorm.
* User: jaredchu
* Date: 31/08/2017
* Time: 11:40
*/
class Node
{
View keybase.md

Keybase proof

I hereby claim:

  • I am jaredchu on github.
  • I am jaredchu (https://keybase.io/jaredchu) on keybase.
  • I have a public key whose fingerprint is 7D45 3874 668F 9B8B 1C5C 0C6C 351C EB42 9280 9AD8

To claim this, I am signing this object:

@jaredchu
jaredchu / script.php
Created Jun 2, 2017
Packagist fake download number
View script.php
// Usage
// php script.php vendor/package [download-number]
if (!isset($argv[1])) {
die("Missing package name\n");
}
if (!isset($argv[2])) {
die("Missing download times\n");
}