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've got an array of file names, with their relative file sizes. I want to break them down into X - size fragments, each | |
fragment representing the byte offset within that file (and also recognize that some of these fragments may point to two or more files) as the fragmentation of the files is measured sequentially. I'm trying to do this neatly, but I think there's something big that I am missing. | |
any ideas? |
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 Fech | |
class Utilities | |
# usage examples: | |
# Fech::Utilities.retrieve_table(:candidate, 2012, :type => :summary, :mode => :to_csv) #=> renders a CSV file; returns nil | |
# Fech::Utilities.retrieve_table(:committee_contribution, 2010, :mode => :to_db, :db => <db location>, :db_table => Sequel.table) | |
def self.retrieve_table(table, cycle, opts={}) | |
table = table.to_s.split("_").map { |t| t.capitalize }.join | |
table = begin | |
Fech.const_get("Fech::#{table}") |
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 Node | |
attr_accessor :data, :nxt, :prev | |
def initialize(data=nil, prev=nil) | |
@data = data | |
@prev = prev | |
@nxt = nil | |
end | |
def add(val) | |
if @nxt.nil? |
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 LoadStream = React.createClass({ | |
getInitialState: function() { | |
return {tweets: []} | |
}, | |
grabTweets: function() { | |
$.getJSON("/gamergate/tweets", function(data){ | |
if (this.isMounted()) { | |
this.setState(data) | |
} |
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 Timeline = React.createClass({ | |
// timeline component starts with no initial tweets/active tweet | |
getInitialState: function() { | |
return { tweets: [], activeTweet: {} }; | |
}, | |
// if called initially, loadTweets makes an Ajax call to the server for 20 tweets using the default | |
// hashtag "#gamergate" as the primary search parameter for the twitter client | |
// otherwise, the function gets called whenever the current number of tweets dips below 20 after removing a tweet |
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
#!/usr/bin/env ruby | |
require 'nokogiri' | |
require 'open-uri' | |
class LittleBits | |
def query_tags | |
@doc = Nokogiri::HTML(open("http://littlebits.cc")) | |
binding.pry | |
count = doc.search("//script").length | |
print "#{count} of <script/> tags on littlebits.cc homepage." |
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 'sinatra' | |
require 'twitter' | |
require 'oauth' | |
require 'yaml' | |
require 'sequel' | |
module ShieldsUp | |
# hold the config keys and the DB info here. | |
CONFIG = YAML.load_file('config.yaml') | |
DB = Sequel.mysql( |
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::fs; | |
use std::ffi::OsStr; | |
use std::path::{self, Path, PathBuf}; | |
// fn get_expansion(file: &PathBuf) { | |
// | |
// } | |
struct Card { | |
name: 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
fn sort_vec(nums: &Vec<i32>) -> Vec<i32> { | |
let mut numbers = nums.clone(); | |
let mut greater_than = vec![]; | |
let mut less_than = vec![]; | |
if numbers.len() < 2 { | |
return numbers | |
} | |
let pivot = get_piv(numbers.pop()); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var thing = 'fun'; |
OlderNewer