Skip to content

Instantly share code, notes, and snippets.

View henryscala's full-sized avatar

henryscala henryscala

  • China
View GitHub Profile
@henryscala
henryscala / cyclelist
Created August 30, 2014 11:10
DoubleLinkedCycleList
shared alias Vec2 => [Integer,Integer];
shared alias Vec2List => CycleList<Vec2>;
Integer x = 0;
Integer y = 1;
shared class CycleListNode<T>(nodeValue,prev=null,next=null) {
shared variable T nodeValue;
shared variable CycleListNode<T>? prev;
@henryscala
henryscala / cyclelistAndCanvasOfDart
Created August 31, 2014 12:52
cyclelistAndCanvasOfDart
import 'dart:html';
void main() {
Vec2 p1=new Vec2(50,50);
Vec2 p2=new Vec2(100,50);
Vec2 p3=new Vec2(100,100);
Vec2 p4=new Vec2(50,100);
HtmlCanvas canvas = new HtmlCanvas("#canvas")
@henryscala
henryscala / vector
Created September 11, 2014 10:13
vector operations
import 'dart:math';
addv(v1, v2){
return [v1[0]+v2[0],v1[1]+v2[1]];
}
subv(v1,v2){
return [v1[0]-v2[0],v1[1]-v2[1]];
}
@henryscala
henryscala / my program of haskell for an online course
Created November 12, 2014 05:36
Lab2 -- my program of haskell for an online course
module Lab2 where
------------------------------------------------------------------------------------------------------------------------------
-- Lab 2: Validating Credit Card Numbers
------------------------------------------------------------------------------------------------------------------------------
-- ===================================
-- Ex. 0
-- ===================================
@henryscala
henryscala / worker.py
Created November 24, 2014 05:57
python script for changing line in a file in patch way
srcFileName = r'file1.java'
dstFileName = r'file2.java'
srcFile = open(srcFileName,'r')
dstFile = open(dstFileName,'w')
def listToStr(alist):
result ='';
for a in alist:
@henryscala
henryscala / vbafunc.bas
Created November 27, 2014 01:53
vba functions
Sub squeezeRow(column, startRow, endRow As Integer)
Dim count As Integer
count = 0
i = startRow
Do While i <= endRow
If Cells(i, column).Value = "" Then
For j = i + 1 To endRow
Cells(j - 1, column).Value = Cells(j, column).Value
Next
Cells(endRow, column) = ""
@henryscala
henryscala / main.go
Created May 28, 2015 06:33
using svgo to draw a logo in SVG format
package main
import (
"github.com/ajstarks/svgo"
"os"
"fmt"
)
/*width 50, height 50*/
func drawHeart(canvas *svg.SVG, x, y int ) {
@henryscala
henryscala / MSC.R
Created October 30, 2015 02:29
Inner DSL of R to generate MSC
# A R program to help generate MSC charts.
# The feature to differentiate it from other similar tools is that it support parallel messages.
# It is in testing phase.
library("grid")
diagram.params <- list(titleLines=1,
headLines=2,
widthPad=1,
heightPad=0.5,
@henryscala
henryscala / findroot.py
Created November 6, 2015 09:43
using sympy to solve(approximate) numeric equations's root (it uses bi-sect method)
In [9]: import sympy
In [11]: from sympy import symbols
In [12]: x = symbols('x')
In [13]: x
Out[13]: x