Skip to content

Instantly share code, notes, and snippets.

Single var Pattern
=======================
function fun() {
var a = 1,
b = 2,
sum = a + b,
myobject = {},
i,
j;
@suage
suage / sicp.scm
Created January 10, 2015 16:42
SICP CH1
;; ex1.2
(/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5))))) (* 3 (- 6 2) (- 2 7)))
(defun print-tag (name alst closingp)
(princ #\<);;1 print an opening angle
(when closingp;;2 check the predicate closingp
(princ #\/))
(princ (string-downcase name)) ;;3 converting lower-case
(mapc (lambda (att) ;;4 iterate through all the attributes in the alist of attr
(format t " ~a=\"~a\"" (string-downcase (car att)) (cdr att))) ;;5 print attr/value pair
alst)
(princ #\>)) ;;6 closing angle bracket
for i in range(1, 101): print(i) if i%3 and i%5 else (print(i, "fizz") if i%5 else (print(i, "buzz") if i%3 else print(i, "fizzbuzz")))
# -*- coding: utf-8 -*-
#this module is used for treating "Sleipnir2.x" DOM manipulation
from PNR2.vars import *
from PNR2.str import *
from PNR2.treatLocation import *
from datetime import date, datetime, timedelta, time
import re, sys, time
import random, math
import win32com.client, win32ui
File Edit Options Buffers Tools HTML Help
{% extends "ykmBase.html" %}
{% block cssExtend %}
<link href="{{ STATIC_URL }}css/datepicker.css" rel="stylesheet">
<style>
body {
padding-top: 40px;
padding-bottom: 40px;
background-color: #f5f5f5;
@suage
suage / or_jsDefinitiveGuideSnippetCH6.js
Last active August 29, 2015 14:07
JavaScript Definitive Guide
// Programming JavaScript
// CH6 - Ojbect
// Property Attribute
// -> writable - specifies whether the value of the property can be set.
// -> enumerable - specifies whether the property name is returned by a for/in loop.
// -> configurable - specifies whether the property can be deleted and whether its attributes can be altered.
// Object Attribute
//start(T_T)
!function() {
var d3 = {version: "3.4.11"};
//compat_start----------------------------------------------------------------(T_T)
//Add compatibility shim for setAttribute[NS] in IE9.
//compat.date(T_T)
//Fix for IE9's style.setProperty.
if (!Date.now) Date.now = function () {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
//it's useful creating graph, even curved graph, ex y = a*x^2
var continuousLine = (function() {
var samples = d3.range(0, 1+1e-6, 2/width);//split [0, 1] to 211 division, fine division makes almost curve line
var discreteLine = d3.svg.line()
.x(function(d, i) { return xS(samples[i]); })
.y(function(d) { return yS(d); });
return function(f){
return discreteLine(samples.map(f));//very short line's sequence makes curve
};