Skip to content

Instantly share code, notes, and snippets.

View sivan's full-sized avatar
🕶️
Inactive

Sivan sivan

🕶️
Inactive
View GitHub Profile
@sivan
sivan / iframe_scale_final.css
Created February 9, 2012 09:27
使用CSS3 Transform缩放iframe
#content_sub iframe[id^="baidu_clb"] {
-webkit-transform: scale(0.6);
-webkit-transform-origin: 100% 100%;
}
#content_sub div[id^="baidu_clb"] {
margin-left: -95px;
margin-top: -40px;
}
@sivan
sivan / style.css
Created July 3, 2012 07:29
Styling children based on their number, with CSS3
/* from http://lea.verou.me/2011/01/styling-children-based-on-their-number-with-css3/ */
/* one item */
li:first-child:nth-last-child(1) {
width: 100%;
}
/* two items */
li:first-child:nth-last-child(2),
li:first-child:nth-last-child(2) ~ li {
@sivan
sivan / ir.css
Created September 17, 2012 12:19
image replacement
.ir {
overflow: hidden;
*text-indent: -999em;
}
.ir:before {
content: "";
display: block;
width: 0;
height: 100%;
@sivan
sivan / index.rb
Created May 23, 2017 05:22
信佛祖 信神兽 报平安 无BUG
# -------------------------------------------------------------------------------------------------------------------------------------- #
# #
# __----~~~~~~~~~~~------___ | 🌈 | #
# . . ~~//====...... __--~ ~~ |   | _oo0oo_ #
# -. \_|// |||\\ ~~~~~~::::... /~ | ⤌ | o8888888o #
# ___-==_ _-~👁 ~ \/ ||| \\ _/~~- | 左 | 88" . "88 #
# __---~~~.==~||\=_ -_--~/_-~|- |\\ \\ _/~ |   | (| -_- |) #
# _-~~ .=~ | \\-_ '-~7 /- / || \
@sivan
sivan / maps.go
Created December 3, 2019 18:00
Go Exercise: Maps
package main
import (
"golang.org/x/tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
m := make(map[string]int)
words := strings.Fields(s)
@sivan
sivan / slices.go
Created December 3, 2019 18:03
Go Exercise: Slices
package main
import (
"fmt"
"golang.org/x/tour/pic"
)
func Pic(dx, dy int) [][]uint8 {
p := make([][]uint8, dy)
@sivan
sivan / fibonacci.go
Last active December 3, 2019 18:40
Go Exercise: Fibonacci closure
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
num, add := 1, -1
return func() int {
num, add = num+add, num
@sivan
sivan / stringers.go
Created December 5, 2019 18:53
Go Exercise: Stringers
package main
import (
"fmt"
"strconv"
"strings"
)
type IPAddr [4]byte
@sivan
sivan / mixin-use-var.scss
Last active May 14, 2020 19:34
Use CSS variable safety.
// Use CSS variable safety
@mixin use-var($property, $value, $fallback: false, $compatible-mode: false) {
// if fallback value given
@if $fallback {
// if need compatible selector
@if $compatible-mode {
@if type-of($compatible-mode) == string {
#{$property}: var(--#{$value}, #{$fallback});
#{$compatible-mode} & {