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 / blacklist.conf
Last active April 9, 2016 14:55
Blacklist spam referal
map $http_referer $bad_referer {
hostnames;
default 0;
"~seo-platform.com" 1;
"~qualitymarketzone.com" 1;
"~video--production.com" 1;
"~hongfanji.com" 1;
"~iloveitaly.com" 1;
"~iloveitaly.co" 1;
"~fbdownloader.com" 1;
@juanpasolano
juanpasolano / es.sh
Created November 5, 2015 05:50 — forked from Globegitter/es.sh
Easy install for elasticsearch on Ubuntu 14.04
cd ~
##If you want to install OpenJDK
#sudo apt-get update
#sudo apt-get install openjdk-8-jre-headless -y
###Or if you want to install Oracle JDK, which seems to have slightly better performance
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
@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 / img-to-svg.js
Created October 26, 2016 17:58
Img tag to inline svg
$(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 October 26, 2016 17:58
Img tag to inline svg
$(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');
<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 / aliases
Last active October 16, 2017 17:49
Aliases for git
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'
@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();
}
| 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 / 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
)
), [])