Skip to content

Instantly share code, notes, and snippets.

View rjmacarthy's full-sized avatar
🐁
The Tetris effect

rj rjmacarthy

🐁
The Tetris effect
  • The Wilderness
  • 21:03 (UTC +01:00)
View GitHub Profile
@tjade273
tjade273 / Database.sol
Last active April 6, 2024 04:32
Example of separated storage and logic
contract Database{
mapping(uint => uint) public _data;
mapping(address => bool) _owners;
function Database(address[] owners){ //Called once at creation, pass in initial owners
for(uint i; i<owners.length; i++){
_owners[owners[i]]=true;
}
}
Update model via mongodb shell:
db.model.update({"_id" : ObjectId("id")}, { $set : { thing : "tothing"}})
@nickpiesco
nickpiesco / README.md
Created October 16, 2015 14:46
DRY out Media Queries with React and Radium

Here at Bloomfire, we’re loving building new components with React. We’re even going all in with using ES6 modules and inline styles. (‘Inline styles?!’ I hear you say? Don’t knock it ’til you’ve tried it.)

There’s a lot of cool stuff we can do with CSS that we can’t do with inline styles, though; and that’s where Radium comes in. Radium not only provides a handy way to style :hover, :focus, and :active states, but it also deftly handles media queries. If you’re using inline styles in React and not using Radium, you should. I’ll give you a minute to go look it over – here’s the link again.

Back? Okay.

We create a style object in each of our React components, which we then reference in the JSX below. Here’s a super-stripped-down example:

// [myAwesomeButton.js]
export const INCREASE = 'INCREASE';
export const DECREASE = 'DECREASE';
contract EternalStorage{
mapping(bytes32 => uint) UIntStorage;
function getUIntValue(bytes32 record) constant returns (uint){
return UIntStorage[record];
}
function setUIntValue(bytes32 record, uint value)
{
import "EternalStorage.sol";
library ProposalsLibrary {
function getProposalCount(address _storageContract) constant returns(uint256)
{
return EternalStorage(_storageContract).getUIntValue(sha3("ProposalCount"));
}
function addProposal(address _storageContract, bytes32 _name)
contract DataVerifiable {
/// @notice throws if ether was sent accidentally
modifier refundEtherSentByAccident() {
if(msg.value > 0) throw;
_
}
/// @notice throw if an address is invalid
import React from 'react'
import ReactDOM from 'react-dom'
import { createStore, combineReducers } from 'redux'
import * as R from 'ramda'
// composition helper
const combine = R.curry((c, o) => x => (<div>{c(x)} {o(x)}</div>))
const combineComponents = (...args) => {
const [first, ...rest] = args
return R.reduce((acc, c) => combine(acc, c), first, rest)
@MeLlamoPablo
MeLlamoPablo / nvmlink
Created February 1, 2017 11:34
Creates a symlink to /usr/bin/node after using nvm
@carlos8f
carlos8f / gist:8367d1d1aeb83062457f293425ec0e03
Created May 28, 2017 05:36
zenbot sim result, 1m period, gdax.ETH-USD, 4 days, 72.97% profit, 68.77% over buy/hold
zenbot sim gdax.ETH-USD --trend_ema 21 --period 1m --max_slippage 0.001 --order_adjust_time 5000 --oversold_rsi_periods 13 --oversold_rsi 14 --neutral_rate 0.01 --days 4
start: 2017-05-23 16:07:00
end: 2017-05-27 22:30:00
{
"asset_capital": 0,
"buy_pct": 98,
"buy_stop_pct": 0,
"currency_capital": 1000,