Skip to content

Instantly share code, notes, and snippets.

Mike Piccolo mfpiccolo

Block or report user

Report or block mfpiccolo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View blue-chip-virtual.js
// I am trying to decide on an API for blue-chip's virtual models.
class Owner extends BaseModel {
static get hasMany() {return [Dog]}
class Dog extends BaseModel {
static get belongsTo() {return [Owner]}
class VirtualOwner extends BaseModel {
mfpiccolo / fetch_json.js
Created Oct 17, 2016
Concept for json api deserializer fetch wrapper.
View fetch_json.js
api_config = {
base_url: 'http://localhost:8065/api/v3',
defaluts: { // if none passed here then use JSON.parse()
success_deserializer: successJsonApiDerserializer,
error_deserializer: errorJsonApiDerserializer,
// has the same defaults as fetch
resources: {
all_team_listings: {
endpoint: 'teams/all_team_listings',
mfpiccolo / diesel.js
Last active Apr 20, 2016
Concept for ruby-diesel
View diesel.js
var diesel = require("diesel")
var User = require('User');
infer_schema = true
infer_models = true # I was thinking this would create Queriable structs with sane defaults based on schema
database_url = "postgres://localhost/ruby_diesel_dev"
model_mapping: {
users: User
use sqlite::Sqlite;
use types::{self, FromSql, FromSqlRow, HasSqlType, Numeric, Float};
use std::error::Error;
use sqlite::connection::SqliteValue;
use std::str::FromStr;
use query_source::Queryable;
use row::Row;
#[derive(Debug, Clone, PartialEq, PartialOrd)]
pub enum SqliteNumeric {
impl<T, U> ToJsonApi for Vec<(T, Option<U>)>
where T: ToResourceObject + Default, U: ToResourceObject
fn serialize(&self) -> String {
self.into_iter().group_by(|&&(a, b)| a)
.map(|(c, d)| d.into_iter().filter_map(|(e,f)| f).collect())
#![feature(custom_derive, core)]
extern crate core;
use std::io;
use std::io::prelude::*;
use core::fmt::Debug;
struct Product {
id: i32,
pub trait Converter {
fn blah(&self) -> &String;
struct This {
convert: String,
struct That {
convert: String,
View ghost.css
pre code {
font-size: 14px;
line-height: 1.2em;
width: 672px;
#disqus_thread {
margin-left: 19%;
margin-right: 19%;
extern crate hyper;
use std::sync::Arc;
use std::thread;
use hyper::Client;
use std::io::Read;
extern crate time;
pub extern fn run_threads() {
let start_time = time::now();
View a-rubyist-rusting-part-5-2.rb
require 'ffi'
module Scrape
extend FFI::Library
ffi_lib './target/debug/libscrape.dylib'
attach_function :run_threads, [], :void
You can’t perform that action at this time.