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
// | |
// QuadraticFormula.m | |
// MathTasksCode | |
// | |
// Created by Eric Li on 7/16/09. Edited by Morgan Jones. | |
// Copyright 2009 § Products. All rights reserved. | |
// | |
#import "QuadraticFormula.h" | |
#import "Fractions.h" |
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
void fr12_lcd::print_wrap(char *msg) { | |
// Copy the message string | |
size_t len = strlen(msg); | |
char *c = (char *)malloc(len); | |
strcpy(c, msg); | |
// Start tokenizing | |
char *p = strtok(c, " "); | |
while (p != NULL) { | |
size_t p_len = strlen(p), len = p_len + this->x; |
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
#include <avr/io.h> | |
.org 0x0000 | |
rjmp run | |
run: | |
; Clear r1 | |
clr r1 | |
; Load 0x01 into r16 for use later |
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 'cinch' | |
class ValveARG | |
include Cinch::Plugin | |
match /!argstatus/, handler: :argstatus | |
def argstatus(m) | |
m.reply "#{m.user.nick}, we're currently waiting for Valve." | |
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
// nice work, #valvearg2 | |
// ... and great job to The_MAZZTer for figuring it out! | |
// how it works: http://d.pr/i/iDp6 | |
// ruby equivalent: [18, 5, 19, 9, 19, 20, 15, 18].collect{|c| (c + 96).chr}.join | |
#include <iostream> | |
using namespace std; | |
void Q(int val) { | |
printf("%c", val + 'a' - 1); |
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
puts (Class.new(Time) {|c| c.send(:define_method, :to_s) {"#{%w(Sun Morn Tir Mid Tur Fre Lore)[wday]}das, #{mday}#{%w(st nd rd th)[(mday >= 11 && mday <= 13 || (a = (mday - (mday.to_f / 10.0).floor * 10) - 1) > 3 ? 3 : a)]} of #{['Morning Star', 'Sun\'s Dawn', 'First Seed', 'Rain\'s Hand', 'Second Seed', 'Midyear', 'Sun\'s Height', 'Last Seed', 'Hearthfire', 'Frostfall', 'Sun\'s Dusk', 'Evening Star'][month - 1]}, 4E #{year - 1810}"}}).now.to_s |
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 = ->(a, b, f) { | |
( | |
(opposite = ->(u, v){u < 0 && v > 0 || u > 0 && v < 0}).call( | |
f_a = f.call(a), | |
f_b = f.call(b) | |
) ? | |
( | |
(f_mid = f.call(mid = (a + b) / 2.0)).abs < Float::EPSILON ? | |
mid : | |
i.call( |
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 | |
# `ruby dm.rb 1d8`, `ruby dm.rb 3d8+5`, `ruby dm.rb 100d10+3`, etc... | |
# down to one line now ;) | |
['Rolling... '.tap{%w(colorize net/http).map &method(:require)}.blue, ((res=->(d, rnd){d.count > 1 ? ((quota = (get = ->(uri={}) {Net::HTTP.start((u = URI::HTTP.build(uri.merge(host: 'www.random.org'))).hostname, u.port) {|h| h.request(Net::HTTP::Get.new(u.request_uri, {'User-Agent' => '<user agent here>'}))} rescue nil}).call(path: '/quota/', query: URI.encode_www_form(format: :plain))).is_a?(Net::HTTPSuccess) && quota.body.strip.to_i > 0 ? ((result = get.call(path: '/integers/', query: URI.encode_www_form(format: :plain, rnd: :new, num: d.first, col: d.first, min: 1, max: d[1], base: 10))).is_a?(Net::HTTPSuccess) ? result.body.split.collect(&:to_i) : rnd.call(d[0], d[1])) : rnd.call(d[0], d[1])) : 'invalid or no dice provided'}.call(((a=ARGV.first.to_s.split(/[d+]/).collect(&:to_i).reject{|d| d <= 0}).length == 2 ? a.push(0) : a), ->(d, n){Array.new(d) {rand(1..n)}})).is_a?(Array) ? "#{res.col |
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 Kernel | |
def std | |
@@std ||= Module.new do | |
def ios | |
Module.new do | |
def ios | |
@@ios ||= Class.new do | |
def initialize stream | |
@stream = stream | |
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
a = ->(s, t) {s.length == t.length && (u = ->(v){v.bytes.reduce(1){|w, x| w * [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103][(x & 0x1f) - 1]}}).call(s) == u.call(t)} |
OlderNewer