Skip to content

Instantly share code, notes, and snippets.

💻
Making

Juan Pablo Solano juanpasolano

💻
Making
Block or report user

Report or block juanpasolano

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
@juanpasolano
juanpasolano / app.jsx
Last active Jun 30, 2019
Sage 9 Wordpress theme
View app.jsx
import React from "react";
import ReactDOM from "react-dom";
import "babel-polyfill";
const App = ()=> {
return <h1>I'm an app</h1>
}
const init = () => {
ReactDOM.render(<App />, document.getElementById("reactApp"));
@juanpasolano
juanpasolano / filters.php
Created Nov 4, 2018
Add custom url to sage 9
View filters.php
<php
add_filter('template_include', function ($template) {
$data = collect(get_body_class())->reduce(function ($data, $class) use ($template) {
return apply_filters("sage/template/{$class}/data", $data, $template);
}, []);
$url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH), '/');
if(strpos($url_path, "inventory/category/") !== false){
$template = get_stylesheet_directory().'/views/virtual-category.blade.php';
echo template($template, $data);
View flatten.js
const assert = require("assert");
export const flattenArray = arr =>
arr.reduce((accumulator, current)=>(
accumulator.concat(
Array.isArray(current) ? flattenArray(current) : current
)
), [])
View gist:f8feb5e16fc578e909d34ec443b59d87
| Item Name | Perfect | Cheap | Max Expensive | Overpriced | Culture | Tier |
|-------------------------------|---------|-------|---------------|------------|----------|-------|
| Vine | 2 | 1 | 2 | 3 | Golem | Tier5 |
| Root | 6 | 3 | 6 | 7 | Golem | Tier5 |
| Teethstone | 6 | 3 | 6 | 7 | Golem | Tier5 |
| Rich Jelly | 6 | 3 | 6 | 7 | Merchant | Tier1 |
| Whetstone | 18 | 11 | 19 | 20 | Golem | Tier5 |
| Venom Jelly | 25 | 15 | 27 | 28 | Merchant | Tier1 |
| Iron Bar | 31 | 18 | 34 | 35 | Golem | Tier5 |
| MerchantWallPot | 62 | 37 | 68 | 69 | Merchant | Tier1 |
@juanpasolano
juanpasolano / App.js
Created Aug 5, 2018
Refetch info graphql
View App.js
import React, { Component } from "react";
import { Query } from "react-apollo";
import { GET_ALL_RECIPES } from "queries";
import RecipeItem from "components/Recipe/RecipeItem";
class AppContent extends Component {
componentDidMount() {
const { refetch } = this.props;
if (refetch) refetch();
}
@juanpasolano
juanpasolano / aliases
Last active Oct 16, 2017
Aliases for git
View aliases
alias g='git'
alias ga='git add'
alias gaa='git add .'
alias gaaa='git add -A'
alias gb='git branch'
alias gbd='git branch -d '
alias gc='git commit'
alias gcm='git commit -m'
alias gco='git checkout'
alias gcob='git checkout -b'
View some-file.liquid
<script>
$(function(){
var collection = window.collection = {% if collection %}{{collection | json}}{% else %}null{% endif %};
{% paginate collection.products by 1000 %}
var products = window.products = {% if collection.products%}{{collection.products | json}}{% else %}null{% endif %};
{% endpaginate %}
var tags = window.tags = {% if collection.all_tags%}{{collection.all_tags | json}}{% else %}null{% endif %};
})
</script>
@juanpasolano
juanpasolano / img-to-svg.js
Created Oct 26, 2016
Img tag to inline svg
View img-to-svg.js
$(function(){
/*
* Replace all SVG images with inline SVG
* usage: <img src="my.svg" class="svg"/>
*/
jQuery('img.svg').each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
@juanpasolano
juanpasolano / img-to-svg.js
Created Oct 26, 2016
Img tag to inline svg
View img-to-svg.js
$(function(){
/*
* Replace all SVG images with inline SVG
* usage: <img src="my.svg" class="svg"/>
*/
jQuery('img.svg').each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
@juanpasolano
juanpasolano / readme.md
Last active Nov 10, 2018
Helpful Margins, padding and spacers
View readme.md

The spacers

Many times a component has different spacings around it depending on where it is located. Spacers help you add paddings and margins of different sizes conveniently, without having to create a new class for every case.

-You get access to classes like m-t-2 which stands to margin-top: 20px, so same goes for something like p-b-3 padding-bottom: 30px. -There is also m-v-2 which stands for vertical margin or margin-top: 20px; margin-bottom:20px; and p-h-3 would be padding horizontal 30px;

This classes use the convention type_position_negative_number_target

Member | Options | Example classes

You can’t perform that action at this time.