This file contains hidden or 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
import javax.swing.*; | |
import java.awt.Color; | |
import java.awt.event.*; | |
import java.awt.geom.*; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import java.awt.Rectangle; | |
public class Ball extends JComponent { |
This file contains hidden or 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
//! rustc 0.10-pre (ee8f45e 2014-02-18 13:41:49 -0800) | |
//! | |
//! Before you bite my head off, this is NOT a recommend way of organizing code! | |
//! It is only a demonstration what you can do in Rust! (wish I put this comment in earlier) | |
//! My intention with this example is to show new people the features of the module system. | |
//! | |
//! The module system in Rust gives you precise control | |
//! over the interface when writing libraries. | |
//! You can write the layout independent of how you organize the code! | |
//! In this example two different conventions are explored. |
This file contains hidden or 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 std::sync::arc::UnsafeArc; | |
use std::cast; | |
use std::comm::Chan; | |
pub struct ArcRefCell<T> { | |
priv inner: UnsafeArc<T> | |
} | |
impl<T: Send> ArcRefCell<T> { | |
pub fn new(value: T) -> ArcRefCell<T> { |
This file contains hidden or 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
select | |
d.tablespace_name tn, | |
d.block_size bs, | |
d.extent_management lm, | |
d.segment_space_management assm, | |
d.status st, | |
to_char(f.bytes/1024,'999,999,999')||'K' bts, | |
to_char((f.bytes-s.free_bytes)/1024,'999,999,999')||'K' used, | |
to_char(round((f.bytes-s.free_bytes)/f.bytes*100),'990.9')||'%' pct, | |
case trunc(33*(f.bytes-s.free_bytes)/f.bytes) |
This file contains hidden or 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(globs)] | |
#![feature(if_let)] | |
extern crate piston; | |
extern crate gfx; | |
mod snakeapp; | |
mod object; | |
mod settings; | |
mod text; |
This file contains hidden or 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
package org.example | |
import griffon.core.artifact.GriffonController | |
import griffon.metadata.ArtifactProviderFor | |
@ArtifactProviderFor(GriffonController) | |
class ExemploActionsController { | |
ExemploActionsModel model | |
void somarAction() { |
This file contains hidden or 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
select | |
-- Session causing the block | |
blockers.blocker_instance_id as blocker_instance_id, | |
blocker.sid as blocker_sid, | |
blocker.serial# as blocker_serial#, | |
blocker.username as blocker_username, | |
blocker.status as blocker_status, | |
blocker.machine as blocker_machine, | |
blocker.program as blocker_program, | |
blocker.sql_id as blocker_sql_id, |
This file contains hidden or 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 std::path::{Path, PathBuf}; | |
struct Model { | |
u: f32, | |
} | |
fn texture_fname(path: &Path) -> PathBuf { | |
let fullname = format!("{}{}", path.file_stem().unwrap().to_str().unwrap(), "_diffuse"); | |
let mut buf = PathBuf::from(path); |
This file contains hidden or 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 std::thread; | |
use std::fs::{self, DirEntry}; | |
use std::path::{Path, PathBuf}; | |
use std::sync::{Arc, Mutex}; | |
use std::io; | |
macro_rules! or_return { | |
($expr:expr) => (match $expr { | |
::std::result::Result::Ok(val) => val, | |
::std::result::Result::Err(err) =>{ |
This file contains hidden or 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 std::fs; | |
use std::io::Read; | |
/// Obtains a list of video extensions from the `/etc/mime.types` file on Linux. | |
pub fn get_video_extensions() -> Result<Vec<String>, &'static str> { | |
fs::File::open("/etc/mime.types").ok() | |
// Return an error if /etc/mime.types could not be found. | |
.map_or(Err("tv-renamer: unable to open /etc/mime.types"), |mut file| { | |
// Create a buffer with the capacity of the file | |
let mut contents = String::with_capacity(file.metadata().map(|x| x.len()).unwrap_or(0) as usize); |