Skip to content

Instantly share code, notes, and snippets.

@cubika
cubika / getQueryString.js
Created January 26, 2016 09:59
getQueryString
function getQueryString(url, name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var index = url.indexOf('?');
var r = url.substr(index).substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
var context = '';
if (r != null)
context = r[2];
reg = null;
r = null;
return context == null || context == '' || context == 'undefined' ? '' : context;
@cubika
cubika / polymer-bootstrap.js
Created May 31, 2015 12:17
window.Polymer
window.Polymer = function(prototype) {
var ctor = desugar(prototype);
// Polymer.Base is now chained to ctor.prototype, and for IE10 compat
// this may have resulted in a new prototype being created
prototype = ctor.prototype;
// native Custom Elements treats 'undefined' extends property
// as valued, the property must not exist to be ignored
var options = {
prototype: prototype
};
@cubika
cubika / app.js
Created January 16, 2014 08:44 — forked from arvis/app.js
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http')
, mongoose = require('mongoose')
, path = require('path');
#star-six {
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid red;
position: relative;
}
#star-six:after {
width: 0;
/**
* Implementation of standard Array methods (introduced in ECMAScript 5th
* edition) and shorthand generics (JavaScript 1.8.5)
*
* Copyright (c) 2013 Alex K @plusdude
* http://opensource.org/licenses/MIT
*/
(function (global, infinity, undefined) {
/*jshint bitwise:false, maxlen:95, plusplus:false, validthis:true*/
"use strict";
<chart caption='Power Generator' xAxisName='Time' showValues='0' divLineAlpha='100' numVDivLines='4' vDivLineAlpha='0' showAlternateVGridColor='1' alternateVGridAlpha='5'>
<categories>
<category label='00:00s' />
<category label='00:04s' />
<category label='00:08s' />
<category label='00:12s' />
<category label='00:16s' />
<category label='00:20s' />
</categories>
<axis title='Power' titlePos='left' tickWidth='10' divlineisdashed='1'>
@cubika
cubika / 365psd.py
Created October 8, 2013 05:43
using thread pool to download psd
# -*- coding:utf-8 -*-
import urllib2,os
import threading
import Queue
from bs4 import BeautifulSoup
#线程池就是只有几个线程,它们进行死循环操作,一直从队列中取数据直到为空
baseUrl = "http://www.365psd.com/day/"
basePath = "E:\\MyDocument\\365psd"
@cubika
cubika / flexslider.css
Created October 5, 2013 07:59
flexslider
/*
* jQuery FlexSlider v2.2.0
* http://www.woothemes.com/flexslider/
*
* Copyright 2012 WooThemes
* Free to use under the GPLv2 license.
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Contributing author: Tyler Smith (@mbmufffin)
*/
@cubika
cubika / jquery.slicebox.js
Created October 5, 2013 07:58
jquery slicebox
/**
* jquery.slicebox.js v1.1.0
* http://www.codrops.com
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2012, Codrops
* http://www.codrops.com
*/
@cubika
cubika / jquery.scrollup.js
Created October 5, 2013 07:57
jquery scrollup
/*
scrollup v2.1.0
Author: Mark Goodyear - http://markgoodyear.com
Git: https://github.com/markgoodyear/scrollup
Copyright 2013 Mark Goodyear.
Licensed under the MIT license
http://www.opensource.org/licenses/mit-license.php