return \ block | extention | function |
---|---|---|
original val | apply |
also |
block result | run |
let |
return \ block | extention | function
window.alert('name: ' + window.__SERVER_SIDE_CONTEXT__.page.property.StructureView.BuildingName) |
def drawCube(x, y, scale = 1) | |
print <<-EOS | |
<g stroke="black" fill="none" transform="matrix(#{scale},0,0,#{scale},#{x},#{y})"> | |
<rect x="50" y="100" width="90" height="90" /> | |
<rect x="50" y="130" width="90" height="30" /> | |
<rect x="80" y="100" width="30" height="90" /> |
#!/bin/sh -e | |
function show_latest_branches () { | |
git branch | \ | |
sed 's/[* ]//g; s/.*/printf "& "; git show --format="%at" -s &/'| \ | |
sh | \ | |
sort -k2nr | |
} | |
// file must be File object. | |
def calcSha1(file) | |
{ | |
MessageDigest md = MessageDigest.getInstance("SHA-1"); | |
file.eachByte 4096, {bytes, size -> | |
md.update(bytes, 0, size); | |
} | |
return md.digest().collect {String.format "%02x", it}.join(); | |
} |
console.log(this === global ? "global" : this) | |
var nstrict = function() { | |
console.log(this === global ? "global" : this) | |
} | |
var strict = function() { | |
"use strict"; | |
console.log(this === global ? "global" : this) |
# https://en.wikipedia.org/wiki/MOI_(file_format) | |
def get_date_from_moi(moi) | |
File.open(moi, "rb") { |file| | |
file.seek(6) | |
bytes = file.read(10) | |
y, mon, d, h, min, ms = bytes.unpack('nCCCCn') | |
return Time.new(y, mon, d, h, min, ms/1000) | |
} | |
end |
It's very desired that every commit in the branch is organized well. One commit changes only one logical part. It shouldn't contain irrevant changes, such as one for UI and another for DB. Such changes must be separated into different commits.
import java.lang.ref.WeakReference; | |
public class Www { | |
public static void main(String args[]) { | |
Runnable r0 = create0(); | |
Runnable r1 = create1(); | |
System.gc(); | |
r0.run(); | |
r1.run(); |
# Trivial example: 2017-01-01 is part of the last week of 2016 because ISO week starts with the Monday. | |
irb(main):004:0> fd2017 = Date.new(2017,1,1) | |
=> #<Date: 2017-01-01 ((2457755j,0s,0n),+0s,2299161j)> | |
irb(main):005:0> fd2017.cweek | |
=> 52 | |
irb(main):006:0> fd2017.cwday | |
=> 7 # Sunday | |
irb(main):007:0> fd2017.cwyear | |
=> 2016 |