Skip to content

Instantly share code, notes, and snippets.

View lopezdp's full-sized avatar
🎯
Focusing

David Lopez lopezdp

🎯
Focusing
View GitHub Profile
@lopezdp
lopezdp / dydxFlashLoanTemplate.sol
Created July 22, 2021 22:35 — forked from cryptoscopia/dydxFlashLoanTemplate.sol
A single-file simplest possible template for a contract that obtains a flash loan from dydx, does things, and pays it back.
// SPDX-License-Identifier: AGPL-3.0-or-later
// The ABI encoder is necessary, but older Solidity versions should work
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// These definitions are taken from across multiple dydx contracts, and are
// limited to just the bare minimum necessary to make flash loans work.
library Types {
enum AssetDenomination { Wei, Par }
@lopezdp
lopezdp / responsiveReactComponent.js
Created September 1, 2019 22:04
Just a template of <Media /> query sizes I use to display elements responsively.
import React, { Component/*, Fragment*/ } from "react";
// Using react containers to achieve responsiveness in Medias
import Container from "react-bootstrap/Container";
import Media from "react-media";
<Container>
{/* Smaller phones portrait */}
<Media query="(min-width: 319px) and (max-width: 567px)">
<p>KnowledgeBase Test 319 - 567</p>
</Media>
@lopezdp
lopezdp / longTermTrends.py
Created July 22, 2018 06:41
Daily Resolution for Long Term (> 5 Years) Google Trends Data
#### connect to google
_pytrends = TrendReq(hl='en-US', tz=360)
#### build the playload
_kw_list = ["bitcoin"]
_cat = 0
_geo = ''
_gprop = ''
# dates can be formated as `2017-12-07 2018-01-07`,`today 3-m`, or `today 5-y` check trends.google.com's url
@lopezdp
lopezdp / media-query.css
Created April 15, 2018 20:34 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@lopezdp
lopezdp / gist:f54e2705146fe56e9c32
Last active August 29, 2015 14:20
13. Bangs ruby arrays
How does a bang modify the list passed into the method?
How can we return a different list with a new item if we dont want to modify the list?
How does bang affect the code below?????
def add_item!(item, list)
#list << item
# # this is what we return from the method
@lopezdp
lopezdp / gist:aa6c93012d470b8c081c
Last active August 29, 2015 14:19
9. Ruby Syntax
What and how are symbols used. What was the purpose of p :hello
how would you use a ruby symbole in the real world?