View solution1.java
import java.util.*;
public class Solution {
private static boolean isPrime(int n) {
if (n < 2) return false;
for (int i = 2; i * i <= n; i++)
if (n % i == 0 || n % (n - i) == 0)
return false;
return true;
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
* {
box-sizing: border-box;
}
View run.rb
loadTestDB
module Video_Manual_2_4
def self.DefaultSetting(loopTime)
tcase = TestCase.new("DefaultSetting")
tcase << TestAction.new(:pressHome_2) do
View btrfs-subvolume-usage.py
#!/usr/bin/env python3
# NOTE: btrfs quota must be enabled for this to work:
# btrfs quota enable /btrfs/
import os
import sys
usage = {}
for line in os.popen('btrfs qgroup show / --raw', 'r'):
# 0/10784 15678980096 557056
if not line.startswith('0/'):
View sf_perf_raw_data.json
{
"value": [
{
"data": [
{
"timeStamp": "2017-04-25T20:30:00Z",
"average": 89.28
},
{
"timeStamp": "2017-04-25T20:31:00Z",
View playground.rs
extern crate rand;
use rand::{thread_rng, Rng};
use rand::distributions::{Normal, IndependentSample};
struct SinglePack {
open_block: Vec<f64>,
open_sum: f64,
blocks: Vec<Vec<f64>>,
}
View index.html
<div class="modal-outer">
<div class="modal-box">
<div class="modal-content">
<!-- CONTENT HERE -->
</div>
</div>
<button class="exit-modal">X</button>
</div>
View faba-v0.2-py.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View cashAmountClass.js
/* Prompt: tackling floating-point imprecision with the CashAmount class
In programming languages such as JavaScript, 0.1 + 0.2 does not equal 0.3. This is true in Ruby, Python, etc. The imprecision is inherent in floating-point arithmetic, it isn't because JavaScript itself is wonky.
These tiny errors can add up and cause actual wrong answers over time if you're not careful. They also make it harder to unit-test your work, since you have to compare within ranges rather than comparing to exact expected values.
To deal with this specifically within a monetary context, let's make a class called CashAmount that accepts double values (e.g., 14.72) and will never suffer from the aforementioned precision problems. A CashAmount represents a collection of bills and coins, such as you might find in your wallet, purse, or a cash register.
Note: you can do this by converting to pennies for all denominations so you are always working with integers, then converting back to a two-decimal float as needed. */
View money exchange
var CashAmount = (amount) => {
this.amount = amount.toFixed(2);
}
CashAmount.prototype.totalInPennies = function() {
var amountInPennies = this.amount.toString().split("");
amountInPennies.splice(-3,1);