Skip to content

Instantly share code, notes, and snippets.

View doitian's full-sized avatar
🎯
Focusing

ian doitian

🎯
Focusing
View GitHub Profile
@doitian
doitian / playground.rs
Created July 12, 2018 03:14 — forked from rust-play/playground.rs
Code shared from the Rust Playground
extern crate mio; // 0.6.14
use mio::event::Evented;
use mio::{Poll, PollOpt, Ready, Registration, Token, Events};
use std::io;
use std::thread;
use std::time::{Instant, Duration};
pub struct Deadline {
@doitian
doitian / edit.html.erb
Created December 16, 2012 13:11 — forked from masqita/type_caster.rb
Add a active model wrapper to edit settings in form. `type_caster.rb` can be put in lib directory, which convert the field to specific type. The wrapper idea also can be used to wrap any other object, such as [Railscasts #396](https://github.com/railscasts/396-importing-csv-and-excel/blob/master/store-with-validations/app/models/product_import.rb)
<h1>Settings</h1>
<%= simple_form_for @settings, :as => 'settings', :url => admin_settings_path, :html => { :class => 'form form-horizontal' } do |f| %>
<fieldset>
<legend>Points Earning</legend>
<%= f.input :site_name %>
<%= f.input :per_page %>
</fieldset>
<div class="control-group">