# This example does an AJAX lookup and is in CoffeeScript
$('.typeahead').typeahead(
# source can be a function
source: (typeahead, query) ->
# this function receives the typeahead object and the query string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(container, pins) { | |
pins.imagesLoaded(function(images){ | |
container.masonry('appended', pins, false); | |
// IE fix preventing not loading images | |
jQuery.each(images, function(i, e, c) { | |
var tmp_src = jQuery(e).attr("src"); | |
if (!e.complete) { | |
jQuery(e).attr("src", ""); | |
jQuery(e).attr("src", tmp_src); |
Organize resources into sections
- GitHub Buttons
- FormBakery: create forms by drag and drop
- Twitter Bootstrap
- Bootstrap Buttons
- Bootstrap Generator
- Kickstrap
- Yahoo! (UI) Design Pattern Library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
import MySQLdb as dbapi | |
__all__ = ['MySql'] | |
class MySql(object): | |
def __init__(self, **kwargs): | |
self.connection = dbapi.connect(**kwargs) | |
self.host_name = kwargs.get('host') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name search.yahoo.com; | |
# only handle requests from Safari search bar | |
if ($args ~ fr=aaplw.*p=) { | |
rewrite ^/search https://duckduckgo.com/?q=$arg_p? break; | |
} | |
# attempt to redirect other requests back to Yahoo, using alternative server name | |
rewrite ^ http://search.ystg1.b.yahoo.com$request_uri? break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 2K bytes over 1 Gbps network 20,000 ns | |
Read 1 MB sequentially from memory 250,000 ns | |
Round trip within same datacenter 500,000 ns | |
Disk seek 10,000,000 ns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.Threading; | |
using System.Diagnostics; | |
using System.Text; | |
namespace StackOverflow.Helpers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace System.Linq | |
{ | |
public class KeyEqualityComparer<T> : IEqualityComparer<T> | |
{ | |
private readonly Func<T, T, bool> comparer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
interface IAdd | |
{ | |
void Add(int val); | |
} | |
struct Foo : IAdd | |
{ | |
public int value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WARNING:此脚本仅做学习和演示用途,在不了解其用途前不建议使用 | |
// 本脚本的用途是将输入内容分页,每次提取一页内容,编辑第二条消息,发送,然后收集结果 | |
// 使用前,需要有两条消息,参考模板 https://chat.openai.com/share/17195108-30c2-4c62-8d59-980ca645f111 | |
// 演示视频: https://www.bilibili.com/video/BV1tp4y1c7ME/?vd_source=e71f65cbc40a72fce570b20ffcb28b22 | |
// | |
(function (fullText) { | |
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
const groupSentences = (fullText, maxCharecters = 2800) => { | |
const sentences = fullText.split("\n").filter((line) => line.trim().length > 0); |