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
module Module1 | |
end | |
module Module2 | |
end | |
module Module3 | |
end | |
class MyClass |
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(core_intrinsics)] | |
#[warn(dead_code)] | |
//#[warn(unused_assignments)] | |
extern crate mmap; | |
extern crate libc; | |
use libc::*; | |
use std::ffi::CString; | |
use std::path::Path; | |
use mmap::{MemoryMap,MapOption}; |
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
const levelup = require('levelup') | |
const leveldown = require('leveldown') | |
const config = require('../config')('persistent') | |
const path = require('path') | |
const lodash = require('lodash') | |
const { promisify } = require('util') | |
const { decode, encode } = require('./de') | |
const openDatabase = (file, options) => | |
promisify(levelup)(leveldown(file, options)) |
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
function readFile(file) { | |
var reader = new FileReader(); | |
var deferred = $.Deferred(); | |
reader.onload = function(event) { | |
deferred.resolve(event.target.result); | |
}; | |
reader.onerror = function() { | |
deferred.reject(this); |
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 std::fmt::Debug; | |
use std::any::Any; | |
use std::io; | |
// Logger function for any type that implements Debug. | |
fn log<T: Any + Debug>(value: &T) { | |
let value_any = value as &Any; | |
// try to convert our value to a String. If successful, we want to | |
// output the String's length as well as its value. If not, it's a |
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 'rails' | |
module OtherModule | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
module ClassMethods | |
def module | |
("::"+self.to_s.split("::").tap {|m| m.pop }.join('::')).constantize |
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
#DIS IS SPARTA! | |
class Module | |
def method_missing(*args, &block) | |
const_get(*args) | |
rescue | |
super(*args, &block) | |
end | |
end |
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
class Object | |
def def(method, &b) | |
self.class.send(:define_method, method, &b) | |
end | |
end |
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
# Controllers | |
class PostController | |
before_filter :set_entry | |
def create | |
@entry.comments.create!(params.merge(author: @current_user)) | |
end | |
protected |
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 Index { | |
fn from_usize(i: usize) -> Self; | |
fn as_usize(&self) -> usize; | |
} | |
#[derive(Debug)] | |
pub struct Fragments<E, I: Index> { | |
list: Vec<Option<E>>, | |
free: Vec<I>, | |
} |
NewerOlder