Skip to content

Instantly share code, notes, and snippets.

View radius's full-sized avatar

darius daftary radius

View GitHub Profile
user_data = XFlow::User.all.map do |u|
name = u.name
email = u.email
num_graphs = XFlow::Graph.user(u).count
num_watchlists = 0
XFlow::Chain.xflow_supported_chains.each do |c|
num_watchlists += XFlow::Watchlist.chain(c).where(user: u).count
end
[name, email, num_graphs, num_watchlists]
end
service ExposureChartService {
rpc GetExposureChart (GetExposureChartRequest) returns (GetExposureChartResponse);
rpc GetExposureInfluencingAddresses (GetExposureInfluencingAddressesRequest) returns (GetExposureInfluencingAddressesResponse);
}
message GetExposureChartRequest {
string network_name = 1;
string address = 2;
}

Keybase proof

I hereby claim:

  • I am radius on github.
  • I am radiusradius (https://keybase.io/radiusradius) on keybase.
  • I have a public key ASCI3mciiym429J8Y6dW3tPZsjKkK7kHYkiJ6mty5W6z1go

To claim this, I am signing this object:

@radius
radius / xhr.html
Created February 27, 2018 01:59
XHR Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Simple XHR Example</title>
<script type="text/javascript">
function reqListener () {
var jsonResponse = JSON.parse(this.responseText);
var characters = jsonResponse.data.results;
@radius
radius / TodoListApp.jsx
Created February 6, 2018 02:06
Todo React App
import React, { Component } from 'react';
import './App.css';
class App extends Component {
render() {
return (
<TodoList />
)
}
}
@radius
radius / premailer_app.py
Created December 12, 2016 20:41
Premailer Usage
import premailer
def parse_template_tags(input_str):
""" Premailer encodes paths in the src attribute of images, so we have to swap them out w original values here """
mapping = (
('%7B%7B%20', '{{ '), ('%20%7D%7D', ' }}'),
('%7B%7B', '{{ '), ('%7D%7D', ' }}'),
)
for k, v in mapping:
https://jsfiddle.net/#&togetherjs=15bbxQITu0
@radius
radius / gist:9102288
Created February 19, 2014 21:42
AngularJS module for executing an expression when an element is shown
angular.module('OnShow', []).
directive('onShow', function () {
return {
controller: function($scope) {
$scope.fireOnce = false;
this.setFireOnce = function(bool) {
$scope.fireOnce = bool;
}
},
link: function(scope, elm, attr) {
@radius
radius / isOnScreen.jqery.js
Created August 20, 2013 18:48
jquery function to tell if a dom element is within the viewport
$.fn.isOnScreen = function(){
var win = $(window);
var viewport = {
top : win.scrollTop(),
left : win.scrollLeft()
};
viewport.right = viewport.left + win.width();
viewport.bottom = viewport.top + win.height();
var bounds = this.offset();
@radius
radius / Default.sublime-theme
Created November 5, 2012 22:58
My Sublime Text 2 default theme (Packages/Theme - Default/Default.sublime-theme)
[
{
"class": "label_control",
"color": [255, 255, 255],
"shadow_color": [24, 24, 24],
"shadow_offset": [0, -1]
},
{
"class": "button_control",
"content_margin": [6, 5, 6, 6],