Skip to content

Instantly share code, notes, and snippets.

Umur Gedik umurgdk

Block or report user

Report or block umurgdk

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 gitlike.go
package main
import (
"bytes"
"crypto/sha1"
"encoding/gob"
"flag"
"fmt"
"io/ioutil"
"os"
View tweet_counter.rs
pub fn run(conn: PooledConnection) -> Result<(), Box<Error>> {
let tweets = get_tweets()?;
let cells = tweets.into_iter()
.filter_map(|tweet| tweet.coordinates)
.filter_map(|(latitude, longitude)| {
let cell_result = Cell::find_containing_core(&*conn, &Point::new(longitude, latitude, Some(4326))).ok();
cell_result.and_then(|cell| cell).map(|mut cell| {
cell.sns += 1;
cell
})
@umurgdk
umurgdk / objects.rs
Last active Aug 6, 2017 — forked from anonymous/playground.rs
Rust code shared from the playground
View objects.rs
use std::borrow::Cow;
use std::fmt::Debug;
use specs::Entity;
use Tile;
use TileRef;
use TileRefMut;
use TileMap;
View mut_iterator.rs
pub struct TileRefMut<'a, T: Tile + 'a> {
pub tile: &'a mut T,
pub x: usize,
pub y: usize
}
pub struct IterMut<'a, T: Tile + 'a> {
tile_map: &'a mut TileMap<T>,
x: usize,
y: usize
View gfx_upload_buffer.rs
extern crate cgmath;
extern crate specs;
#[macro_use]
extern crate gfx;
extern crate gfx_window_glutin;
extern crate glutin;
// Logging
#[macro_use]
View sdl.rs
for event in self.events.poll_iter() {
match event {
Event::Quit { .. } => self.running = false,
event => self.input.update(&self.events, event)
}
}
View generated.rs
#![feature(prelude_import)]
#![no_std]
#![feature(plugin)]
#![plugin(slave_codegen)]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate std as std;
extern crate slave;
View slave_codegen.rs
#![crate_type="dylib"]
#![feature(quote, plugin_registrar, rustc_private)]
extern crate slave;
extern crate proc_macro;
extern crate rustc_plugin;
extern crate syntax;
use rustc_plugin::Registry;
View worker.rs
#[derive(Worker)]
struct StatsWorker;
impl StatsWorker {
#![command]
fn write(&mut self) {
// Write some data to redis
}
#![command]
View view.rs
pub mod container;
pub mod stack_view;
pub mod label;
pub use self::container::Container;
pub use self::stack_view::StackView;
pub use self::label::Label;
use ui::geom::*;
use ui::renderer::Renderer;
You can’t perform that action at this time.