Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<head>
<script src="https://code.jquery.com/jquery-2.2.2.min.js" integrity="sha256-36cp2Co+/62rEAAYHLmRCPIych47CvdM+uTBJwSzWjI=" crossorigin="anonymous"></script>
</head>
<body>
<div>
<input type='number' class='bottle-number' value='0'>
<button onclick="removeBottle()">Remove Bottles</button>
<button onclick="addBottle()">Add Bottles</button>
</div>
@wismer
wismer / typesafe.rb
Last active March 7, 2016 21:32
I want to enforce types in ruby - how do I do it?
require 'pry'
class TypeError < StandardError; end
class TypeSafe
def self.typesafe_methods(*methods)
end
def self.typesafe(*args)
@wismer
wismer / rust-highlighter-react.js
Created October 17, 2015 17:25
React code for a post I'll never publish.
// jshint unused:true, esnext:true, expr:true
var Stack = React.createClass({
getInitialState() {
return {
showProcess: false,
stackProgress: 0,
activeCell: [0,0],
functions: [
{
@wismer
wismer / index.html
Created October 14, 2015 21:49 — forked from anonymous/index.html
Our ScriptEd Class // source http://jsbin.com/wuhede
<!DOCTYPE html>
<html>
<head>
<title>Our ScriptEd Class</title>
<style id="jsbin-css">
body {
font-family: sans-serif;
}
p {
@wismer
wismer / index.html
Last active August 29, 2015 14:28 — forked from anonymous/index.html
JS Bin // source http://jsbin.com/pusunibiru
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var thing = 'fun';
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());
use std::fs;
use std::ffi::OsStr;
use std::path::{self, Path, PathBuf};
// fn get_expansion(file: &PathBuf) {
//
// }
struct Card {
name: String,
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(
#!/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."
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