This file contains hidden or 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
def add(a,b): | |
return a + b | |
def subtract(a,b): | |
return a - b | |
def divide(a,b): | |
return a / b |
This file contains hidden or 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
import System.Directory | |
import Control.Monad (filterM, mapM, liftM) | |
import System.FilePath ((</>)) | |
getDirsRec :: FilePath -> IO [FilePath] | |
getDirsRec d = do | |
dirContents <- getDirectoryContents d | |
let dirContents' = [ d </> x | x <- dirContents, x /= ".", x /= ".." ] | |
dirs' <- mapM dirRec dirContents' | |
return (concat dirs' ++ [d]) |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#define INTSIZE(x) (sizeof(x)/sizeof(int)) | |
int bs_test[] = { 1, 5, 9, 11, 15, 19, 21, 22, 27, 31, 55, 59 }; | |
int itera = 0; | |
int find_bs(int n) { |
This file contains hidden or 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
; The hint is that the state transformation (a) should leave the product b^n a unchanged throughout the states | |
(define (fast-expt-iter b n a) | |
(cond ((= n 0) a) | |
((even? n) (fast-expt-iter (square b) (/ n 2) a)) ; Uses (b^2)^(n/2) = (b^(n/2))^2 | |
(else (fast-expt-iter b (- n 1) (* a b))))) ; b^n a = b^(n - 1) a b |
This file contains hidden or 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
(define (* a b) | |
(cond ((= a 1) b) | |
((even? a) (* (halve a) (double b))) | |
(else (+ a (* a (- b 1))))) | |
) |
This file contains hidden or 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
; Design c such that the product a * b remains unchanged from state to state | |
(define (iter-mult a b c) | |
(cond ((= b 0) c) | |
((even? a) (iter-mult (halve a) (double b) c)) | |
(else (iter-mult a (- b 1) (+ c a))))) |
This file contains hidden or 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
curl -X POST http://localhost:8080/wordpress3/wp-json/wc/v1/products \ | |
-u key:secret \ | |
-H "Content-Type: application/json" \ | |
-d '{ | |
"name": "Premium Quality", | |
"type": "simple", | |
"regular_price": "21.99", | |
"description": "Test", | |
"short_description": "Test", | |
"downloadable": true, |
This file contains hidden or 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
<?php | |
/* | |
Plugin Name: PLUpload Demo | |
Plugin URI: http://wordpress.org/ | |
Description: This is a demo that uses core PLUpload. | |
Author: Boro Sitnikovski | |
Version: 1.0 | |
Author URI: http://bor0.wordpress.com/ | |
*/ |
This file contains hidden or 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
Def 1: |A| = n iff there is a bijection from A to {1,2,3,...,n}. | |
Lemma 1: if f is a bijection, then f^(-1) is a bijection | |
Lemma 2: Show that if f : A -> B and g : B -> C are bijections, then g ◦ f is a bijection. | |
Prove: Given f : A -> B is a bijection, prove that |A| = |B|. | |
Proof. | |
For |A| = n, we have that there exists a bijection g : { 1, 2, ..., n } -> A | |
For |B| = m, we have that there exists a bijection h : {1, 2, ..., m } -> B | |
Let |f| = F. |
This file contains hidden or 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
// based off of https://github.com/bor0/misc/blob/master/2017/tree.js | |
// example: https://github.com/bor0/misc/blob/master/2017/tree_test.js | |
var tree = { | |
v: 1, | |
l: { | |
v: 2, | |
l: { | |
v: 3, | |
l: { v: 4 }, |
OlderNewer