Skip to content

Instantly share code, notes, and snippets.

View juanpasolano's full-sized avatar
💻
Making

Juan Pablo Solano juanpasolano

💻
Making
View GitHub Profile
@juanpasolano
juanpasolano / api models Locations.js
Created September 9, 2014 21:50
seed database on sails js
/**
* Locations.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
seedData:[
@juanpasolano
juanpasolano / app.jsx
Last active May 1, 2021 00:32
Sage 9 Wordpress theme
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"));
.lq-choices {
display:flex;
}
@juanpasolano
juanpasolano / readme.md
Last active December 19, 2019 22:45
County Map readme

How to use it

Install dependencies and build the library from the terminal

yarn install
yarn build

This will generate some files in the dist folder.

To use the map import dist/main.js script and initialize it with window.initMapApp(element)

# ----------------------
# Git Aliases
# ----------------------
alias ga='git add'
alias gaa='git add .'
alias gaaa='git add -A'
alias gb='git branch'
alias gf='git fetch'
alias gplo='git pull origin'
alias gbd='git branch -d '
@juanpasolano
juanpasolano / readme.md
Last active November 10, 2018 02:39
Helpful Margins, padding and spacers

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

@juanpasolano
juanpasolano / filters.php
Created November 4, 2018 04:25
Add custom url to sage 9
<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);
@juanpasolano
juanpasolano / flatten.js
Created October 5, 2018 15:48
Flatten array
const assert = require("assert");
export const flattenArray = arr =>
arr.reduce((accumulator, current)=>(
accumulator.concat(
Array.isArray(current) ? flattenArray(current) : current
)
), [])
| 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 August 5, 2018 00:19
Refetch info graphql
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();
}