Skip to content

Instantly share code, notes, and snippets.

View David-Melo's full-sized avatar
🖥️
Coding Towards The Singularity

David Melo David-Melo

🖥️
Coding Towards The Singularity
View GitHub Profile
@cryptoscopia
cryptoscopia / dydxFlashLoanTemplate.sol
Created October 21, 2020 06:42
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 }
@stevecastaneda
stevecastaneda / Example.tsx
Created July 16, 2020 00:49
A Tailwind-ready Modal using React Aria from Adobe
import React, { useState, useContext, useRef } from "react";
import { useOverlayTriggerState } from "@react-stately/overlays";
import { useButton } from "@react-aria/button";
import { Modal } from "components/overlays/Modal";
export function Example() {
let state = useOverlayTriggerState({});
function onOpen() {
state.open();
@richbai90
richbai90 / PageA.jsx
Last active January 12, 2020 01:30
Next.js + ApolloClient + ApolloLinkState
import Paper from "@material-ui/core/Paper";
import { withStyles } from "@material-ui/core/styles";
import { graphql } from "react-apollo";
import { compose } from 'recompose';
import getTree from './queries/getTree';
import styles from './styles';
const Canvas = ({
classes,
// activeItem,
@taras-d
taras-d / react-native-on-vs-emulator-and-win10.md
Last active September 1, 2021 08:20
React native on VS Emulator and Windows 10
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@lelandrichardson
lelandrichardson / ko-convenience.js
Created March 5, 2014 01:11
Knockout.js Custom Utility Bindings
(function (ko, handlers, unwrap, extend) {
"use strict";
extend(handlers, {
href: {
update: function (element, valueAccessor) {
handlers.attr.update(element, function () {
return { href: valueAccessor() };
});
}
},
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 3, 2024 12:59
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@tschaub
tschaub / AngularStyle.md
Last active December 20, 2016 15:28
Opinionated whitespace guide for AngularJS modules

AngularJS Whitespace Guide

The purpose of this style guide is to suggest formatting conventions for AngularJS modules that result in readible, maintainable, and lint free code (see the linter configurations for JSHint and gjslint.py.

All-in-one example

Typically, an AngularJS application would be structured with many modules in separate files. The example below shows a monolithic module to illustrate the formatting conventions for various module methods.

angular.module('module.name', [
@mikermcneil
mikermcneil / sails_godaddy_ca_ssl_example.js
Created November 14, 2013 03:24
/** * An example of how to use a CA certificate in your Sails app. * * Would love to see support for the `ca` key on the main ssl config object * (if you write it up, please just send the PR to the associations branch so it's easier to merge-- thanks!) */
/**
* An example of how to use a CA certificate in your Sails app.
*
* Would love to see support for the `ca` key on the main ssl config object
* (if you write it up, please just send the PR to the associations branch so it's easier to merge-- thanks!)
*/
var fs = require('fs');
@IskenHuang
IskenHuang / local.js
Created October 10, 2013 15:37
sails.js deploy to openshift setup
module.exports = {
host: process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1',
// port: process.env.PORT || 1337,
port: process.env.OPENSHIFT_NODEJS_PORT || 80,
// environment: process.env.NODE_ENV || 'development'
// environment: process.env.NODE_ENV || 'production'
environment: process.env.NODE_ENV || 'development'