Skip to content

Instantly share code, notes, and snippets.

Ryosuke whoisryosuke

Block or report user

Report or block whoisryosuke

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@whoisryosuke
whoisryosuke / git-private-clone.bash
Created Jul 15, 2019
Git/Dev Ops - Clone from private repo (into a remote server / locally / etc) - via: https://github.community/t5/How-to-use-Git-and-GitHub/Clone-private-repo/td-p/12616
View git-private-clone.bash
git clone https://gitusername:mygithubpassword@github.com/strafe/project.git .
@whoisryosuke
whoisryosuke / copy.bash
Created Jul 11, 2019
Copy SSH key to clipboard
View copy.bash
pbcopy < ~/.ssh/id_rsa.pub
@whoisryosuke
whoisryosuke / massInsertOrUpdate.php
Created Jun 18, 2019 — forked from RuGa/massInsertOrUpdate.php
Mass (bulk) insert or update on duplicate for Laravel 4/5
View massInsertOrUpdate.php
/**
* Mass (bulk) insert or update on duplicate for Laravel 4/5
*
* insertOrUpdate([
* ['id'=>1,'value'=>10],
* ['id'=>2,'value'=>60]
* ]);
*
*
* @param array $rows
View jquery-iife-boilerplate.js
// IIFE keeps all code out of global scope
(function($, window, document) {
// The $ is now locally scoped
$(function() {
// The DOM is ready!
// equiv of $(document).ready(function () {
});
}(window.jQuery, window, document));
View infinite-scroll.md

collection-grid.liquid

{% paginate collection.products by 20 %}
    
    <!-- START PRODUCTS -->
    {% for product in collection.products %}
    	    <div class="product" id="product-{{ forloop.index | plus:paginate.current_offset }}">
                {% include 'product' with product %}
            </div> 
View shopify-dump-variable.md

Create a snippet named "dump.liquid" with the following code snippet
Note: if you use a different filename for the liquid snippet, make sure the variable being passed through liquid's json filter is also the same name, otherwise this shorthand usage won't work as expected

'dump.liquid'
<script type="text/javascript">
 console.log("Dumping");
 console.log({{ dump | json }});
</script>

Usage in template files:

View usePromise.js
import { useState, useEffect, useCallback } from 'react'
function usePromise(createPromise) {
const [error, setError] = useState()
const [value, setValue] = useState()
useEffect(() => {
let current = true
createPromise().then(
View react-debounce.md

2019: try hooks + promise debouncing

This is the most up to date version of how I would solve this problem. I would use:

This is some initial wiring but you are composing primitive blocks on your own, and you can make your own custom hook so that you only need to do this once.

@whoisryosuke
whoisryosuke / clean.sh
Created May 12, 2019 — forked from zephraph/clean.sh
Clean up node_modules
View clean.sh
#!/bin/bash
DAYS_SINCE_LAST_CHANGE=14
SEARCH_PATH="./Git"
TOTAL_BYTES_REMOVED=0
Mb=1000000
Kb=1000
node_modules=$(find $SEARCH_PATH -name "node_modules" -type d -prune)
You can’t perform that action at this time.