Skip to content

Instantly share code, notes, and snippets.

View crossai-2033's full-sized avatar
😇
I may be slow to respond.

LC crossai-2033

😇
I may be slow to respond.
View GitHub Profile
@sofish
sofish / urlparser.js
Last active March 18, 2021 11:31
URL Parser
var parser = function(url) {
var a = document.createElement('a');
a.href = url;
var search = function(search) {
if(!search) return {};
var ret = {};
search = search.slice(1).split('&');
for(var i = 0, arr; i < search.length; i++) {
@staltz
staltz / introrx.md
Last active June 29, 2024 15:58
The introduction to Reactive Programming you've been missing
@fouber
fouber / fis-conf.js
Last active August 29, 2015 14:01
fis core
/*******************************************
* 实际使用展示,用户配置文件 fis-conf.js
*******************************************/
//后缀映射
fis.config.merge({
roadmap : {
ext : {
coffee : 'js',
less : 'css',
@willerce
willerce / noderce-data.js
Created March 13, 2014 10:57
Noderce 数据导出脚本
//需要安装两个依赖包
// npm install mongoskin
// npm install moment
// 根目录建立一个 markdown 目录保存文章
var mongo = require('mongoskin');
var moment = require('moment');
var fs = require('fs');
//这里需要数据库连接串
var db = mongo.db("mongodb://", {native_parser: true});
@yyx990803
yyx990803 / starcounter.js
Last active May 29, 2024 20:41
Count your total stars!
var https = require('https'),
user = process.argv[2],
opts = parseOpts(process.argv.slice(3))
request('/users/' + user, function (res) {
if (!res.public_repos) {
console.log(res.message)
return
}
var pages = Math.ceil(res.public_repos / 100),
@jookyboi
jookyboi / python_resources.md
Created October 19, 2013 20:19
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@yyx990803
yyx990803 / props.md
Last active March 28, 2017 11:39
关于应不应该把属性的默认值放在prototype里

TL,DR: 务必总是在构建函数里定义实例属性。

在小胖的PoorPhy物理库里,有很多类似这样的代码:

function WorldA () {
  // ...
}

WorldA.prototype = {
@mutoo
mutoo / better_shuffle.js
Last active December 19, 2015 10:29
By counting the distribution of numbers after simple shuffle, statistics indicate that the probability of distribution of numbers is inequality;
var numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
var total = [];
var testCount = 10000;
for (var i = 0; i < numbers.length; i++) {
total[i] = [];
for (var j = 0; j < numbers.length; j++) {
total[i][j] = 0;
}
};
@pmeenan
pmeenan / user-timing-rum.js
Last active January 18, 2024 23:46
Support routine for adding W3C user timing events to a site. Includes some basic polyfill support for browsers that don't support user timing or navigation timing (though the start time for non-navigation timing support could be improved with IE < 9 to use IE's custom start event).
// Support routines for automatically reporting user timing for common analytics platforms
// Currently supports Google Analytics, Boomerang and SOASTA mPulse
// In the case of boomerang, you will need to map the event names you want reported
// to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable:
// rumMapping = {'aft': 'custom0'};
(function() {
var wtt = function(n, t, b) {
t = Math.round(t);
if (t >= 0 && t < 3600000) {
// Google Analytics
@vincenting
vincenting / client.py
Last active February 5, 2021 06:42
微信公共平台脚本
# coding=utf-8
__author__ = 'Vincent Ting'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Vincent Ting'
import cookielib
import urllib2