Skip to content

Instantly share code, notes, and snippets.

View NSAttributedString+Interpolation.swift
import UIKit
/* Example of how to use it:
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel!
@IBOutlet weak var textView: UITextView!
@lionhylra
lionhylra / NSAttributedString+compose.swift
Last active Jan 20, 2020
A NSAttributedString extension that adds a convenient method for composing a NSAttributedString with links and images.
View NSAttributedString+compose.swift
import UIKit
// How to use:
/*
let label = UILabel()
let textView = UITextView()
label.attributedText = .compose(
"Please go to ",
.link(label: "Google",
@lionhylra
lionhylra / scrollable_overlay
Created Nov 24, 2013
类似于perinterest的overlay效果
View scrollable_overlay
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.noscroll{
overflow:hidden;
}
.mask{
position:fixed;
overflow-y:scroll;
@lionhylra
lionhylra / loadImgByUrl.js
Created Nov 16, 2013
jQuery常用 通过url加载图片 | 图片统一尺寸 | 窗口时滚动加载 | 窗口平滑滚动 | 密码强度
View loadImgByUrl.js
var nextimage = "http://www.gbtags.com/gb/networks/uploadimgthumb/55d67b14-fb25-45e7-acc8-211a41047ef0.jpg";
$(document).ready(function(){
window.setTimeout(function(){
var img = $("<img>").attr("src", nextimage).load(function(){
$('div').append(img);
});
}, 100);
});
View LinQ.cs
public ActionResult SearchIndex(string searchString)
{
var movies = from m in db.Movies
select m;
if (!String.IsNullOrEmpty(searchString))
{
movies = movies.Where(s => s.Title.Contains(searchString));
}
@lionhylra
lionhylra / animation.css
Created Nov 2, 2013
CSS3 animation basic
View animation.css
/*basic*/
@keyframes myfirst
{
from {background: red;}
to {background: yellow;}
}
@-webkit-keyframes myfirst /* Safari and Chrome */
{
from {background: red;}
@lionhylra
lionhylra / 3column-all-dynamic.css
Created Oct 30, 2013
页面布局Layout 3 columns / left and right, content are all dynamic. 3 columns / left and right fixed, content is dynamic.
View 3column-all-dynamic.css
#left {
position: absolute;
left: 2%;
width: 22%;
top: 106px;
background-color: #ffffff;
}
#content {
position: absolute;
left: 25%;
View triangle.html
<!DOCTYPE html>
<html>
<head>
<style>
html,body{text-align: center;}
body{
text-align: center;
margin: 0;
padding:0;
background-color: gray;
View html5.html
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="Ståle Refsnes">
<meta charset="UTF-8">
<style type="text/css">
div{
color:red;
@lionhylra
lionhylra / animation.css
Created Oct 5, 2013
元素出现动画
View animation.css
/* Effect 1: opacity */
.grid.effect-1 li.animate {
-webkit-animation: fadeIn 0.65s ease forwards;
-moz-animation: fadeIn 0.65s ease forwards;
animation: fadeIn 0.65s ease forwards;
}
@-webkit-keyframes fadeIn {
to { opacity: 1; }
}