Skip to content

Instantly share code, notes, and snippets.

View seajean's full-sized avatar

Sean.J seajean

  • Alibaba
  • Hangzhou China
View GitHub Profile
// This function creates a new anchor element and uses location
// properties (inherent) to get the desired URL data. Some String
// operations are used (to normalize results across browsers).
function parseURL(url) {
var a = document.createElement('a');
a.href = url;
return {
source: url,
protocol: a.protocol.replace(':',''),
@seajean
seajean / dabblet.css
Created October 5, 2015 11:09
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
$(function(){
var postData={title: "My New Post", content: "This is my first post!"};
getTemplate('template-1',postData).done(function(data){
$('body').append(data)
})
});
function getTemplate( name,data){
var d=$.Deferred();
//+------------------------------------------------------------------+
//| Automated Trend Lines.mq4 |
//| Ryan Sheehy, CurrencySecrets.com |
//| http://www.currencysecrets.com |
//+------------------------------------------------------------------+
#property copyright "Ryan Sheehy, CurrencySecrets.com"
#property link "http://www.currencysecrets.com"
/*
* This script automates the generation and plotting of sloping trend
//Get DOM elements based on the given CSS Selector - V 1.00.A Beta
//http://www.openjs.com/scripts/dom/css_selector/
function getElementsBySelector(all_selectors) {
var selected = new Array();
if(!document.getElementsByTagName) return selected;
all_selectors = all_selectors.replace(/\s*([^\w])\s*/g,"$1");//Remove the 'beutification' spaces
var selectors = all_selectors.split(",");
// Grab all of the tagName elements within current context
var getElements = function(context,tag) {
if (!tag) tag = '*';
function trim(str)
{
return str.replace(/(^\s*)|(\s*$)/g,"");
}
function timeSince(date) {
var seconds = Math.floor((new Date() - date) / 1000);
var interval = Math.floor(seconds / 31536000);
if (interval > 1) {
return interval + " years";
}
interval = Math.floor(seconds / 2592000);
/*! normalize.css v2.1.2 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
article,
aside,
details,
@seajean
seajean / getElementStyle
Created December 12, 2013 08:16
get element style property
function getStyle(el,styleProp)
{
var x = document.getElementById(el);
if (x.currentStyle)
var y = x.currentStyle[styleProp];
else if (window.getComputedStyle){
console.log(document.defaultView.getComputedStyle(x,null));
var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
}
return y;
// UPDATE: For latest code, see https://github.com/cstrahan/Showdown.as
//
// Showdown.as -- An ActionScript port of showdown.js
//
// Copyright (c) 2010 Charles Strahan.
//
// Original Showdown Copyright (c) 2007 John Fraser.
// <http://attacklab.net/showdown/>
//
// Original Markdown Copyright (c) 2004-2005 John Gruber