Skip to content

Instantly share code, notes, and snippets.

View agumonkey's full-sized avatar

gum agumonkey

  • NONE
  • Dark side of the moon @ ['tkf8-2-1', 'ay21-3', '3263-827']
View GitHub Profile
<?php
namespace CHH;
trait MetaObject
{
protected static $__metaClass;
static function setMetaClass(MetaClass $metaClass)
{
(require rackunit)
(require rackunit/text-ui)
(define q1
(test-suite
"question 1 : warm up, project, inverse"
(check-equal? 1000 (* 10 10 10) "trivial equality")
(check-exn exn:fail? (lambda () (error "DUCK!"))) "test for function that should fail"))
(run-tests q1)
irb(main):001:0> a = [1,2,3]
irb(main):001:0> a = [1,2,3]
=> [1, 2, 3]
irb(main):002:0> b = a << 4
b = a << 4
=> [1, 2, 3, 4]
irb(main):003:0> a
a
=> [1, 2, 3, 4]
@agumonkey
agumonkey / cprv.py
Last active December 15, 2015 11:09
tired of my bash/zsh misunderstandings, wrote a magnificent `cp -Rv` in python.
import os
import subprocess
def cmd(command):
p = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
return iter(p.stdout.readline, b'')
def pre(path):
(require 'dash)
(defvar *hw/percent* 0.9)
(defvar *pr/percent* 0.1)
(defvar *week/percent* 0.1)
(defvar *exam/percent* 0.15)
(defun weekly-grades (hp)
(let ((hw (car hp))
(pr (cdr hp)))
@agumonkey
agumonkey / browse-kill-ring.el
Last active December 15, 2015 12:48
browse-kill-ring augmented with "!" key to trim [[:blank:]]~ items
;;; browse-kill-ring.el --- interactively insert items from kill-ring -*- coding: utf-8 -*-
;; Copyright (C) 2001, 2002 Colin Walters <walters@verbum.org>
;; Author: Colin Walters <walters@verbum.org>
;; Maintainer: Nick Hurley <hurley@cis.ohio-state.edu>
;; Created: 7 Apr 2001
;; Version: 1.3a (CVS)
;; X-RCS: $Id: browse-kill-ring.el,v 1.2 2008/10/29 00:23:00 hurley Exp $
;; URL: http://freedom.cis.ohio-state.edu/~hurley/
class Object
def mysum
0
end
end
class Fixnum # The class belonging to small integers
def mysum
self # The sum of an integer is just itself
end
(progn
(message ":package")
(require 'package)
(add-to-list 'package-archives
'("marmalade" .
"http://marmalade-repo.org/packages/"))
(package-initialize)
(package-refresh-contents))
;;; ...
// table -> [dom]
var lines = jQuery("#gridview-1035 table tr");
// [dom] -> [str]
var parse = function (i,e) {
var s = e.textContent.split(" ");
return s[0] ? s[0].trim() : null; // if (s[0]) { return s[0].trim(); } else return null;
};
files = lines.map(parse);
;;; caret located "wat"
(message "wat")
(defun wat ()
.|. "wat")
;;; C-( should? wrap "wat" but eats the previous s-exp
((message "wat")
defun wat ()
"wat")