This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var diesel = require("diesel") | |
var User = require('User'); | |
diesel.config({ | |
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | |
.collect(); | |
"some".to_string() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(custom_derive, core)] | |
extern crate core; | |
use std::io; | |
use std::io::prelude::*; | |
use core::fmt::Debug; | |
#[derive(Debug)] | |
struct Product { | |
id: i32, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub trait Converter { | |
fn blah(&self) -> &String; | |
} | |
struct This { | |
convert: String, | |
} | |
struct That { | |
convert: String, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pre code { | |
font-size: 14px; | |
line-height: 1.2em; | |
width: 672px; | |
} | |
#disqus_thread { | |
margin-left: 19%; | |
margin-right: 19%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate hyper; | |
use std::sync::Arc; | |
use std::thread; | |
use hyper::Client; | |
use std::io::Read; | |
extern crate time; | |
#[no_mangle] | |
pub extern fn run_threads() { | |
let start_time = time::now(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ffi' | |
module Scrape | |
extend FFI::Library | |
ffi_lib './target/debug/libscrape.dylib' | |
attach_function :run_threads, [], :void | |
end | |
Scrape.run_threads() |
NewerOlder