Skip to content

Instantly share code, notes, and snippets.

@markandey
markandey / htmlcsstestpage.html
Created Nov 22, 2019
Html5 and css3 test page
View htmlcsstestpage.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML5 Test Page</title>
</head>
<body>
<div id="top" class="page" role="document">
<header role="banner">
View locales.md

Both list has this one

["af-NA","af","agq","ak","am","ar-AE","ar-BH","ar-DJ","ar-DZ","ar-EG","ar-EH","ar-ER","ar-IL","ar-IQ","ar-JO","ar-KM","ar-KW","ar-LB","ar-LY","ar-MA","ar-MR","ar-OM","ar-PS","ar-QA","ar-SA","ar-SD","ar-SO","ar-SS","ar-SY","ar-TD","ar-TN","ar-YE","ar","as","asa","ast","az-Cyrl","az-Latn","az","bas","be","bem","bez","bg","bm","bn-IN","bn","bo-IN","bo","br","brx","bs-Cyrl","bs-Latn","bs","ca-AD","ca-ES-VALENCIA","ca-FR","ca-IT","ca","cgg","chr","cs","cy","da-GL","da","dav","de-AT","de-BE","de-CH","de-LI","de-LU","de","dje","dsb","dua","dyo","dz","ebu","ee-TG","ee","el-CY","el","en-001","en-150","en-AG","en-AI","en-AS","en-AU","en-BB","en-BE","en-BM","en-BS","en-BW","en-BZ","en-CA","en-CC","en-CK","en-CM","en-CX","en-DG","en-DM","en-ER","en-FJ","en-FK","en-FM","en-GB","en-GD","en-GG","en-GH","en-GI","en-GM","en-GU","en-GY","en-HK","en-IE","en-IM","en-IN","en-IO","en-JE","en-JM","en-KE","en-KI","en-KN","en-KY","en-LC","en-LR","en-LS","en-MG","en-MH","en-MO","en-MP","en-MS","en-
View host.js
var http = require('http');
var url = require('url');
var fs = require('fs');
// borrowed from ry who stole it from jack- thanks
// https://github.com/ry/node_chat/blob/master/fu.js
var mime = {
// returns MIME type for extension, or fallback, or octet-steam
lookupExtension: function(ext, fallback) {
View gitenv.sh
source ~/bin/git-prompt.sh
set_prompt () {
Last_Command=$? # Must come first!
Blue='\[\e[01;34m\]'
White='\[\e[01;37m\]'
Red='\[\e[01;31m\]'
Green='\[\e[01;32m\]'
Pink='\[\e[01;35m\]'
Reset='\[\e[00m\]'
View git-prompt.sh
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
@markandey
markandey / pullData.js
Created May 23, 2013
pulls data from YQL and puts in a spreadsheet
View pullData.js
function pullData() {
//select * from yahoo.finance.quote where symbol in ("YHOO","AAPL","GOOG","MSFT")
var url="http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quote%20where%20symbol%20in%20(%22YHOO%22%2C%22AAPL%22%2C%22GOOG%22%2C%22MSFT%22)&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
var response = UrlFetchApp.fetch(url);
var json=JSON.parse(response.getContentText());
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var quotes=json.query.results.quote;
for(var i=0;i<quotes.length;i++){
col=i+1;
@markandey
markandey / everythingatonce.js
Created Dec 21, 2012
How to get output of multiple asynchronous calls in one callback.
View everythingatonce.js
function getGroupCallBackGenerator(timeOut,finalCallback){
var waitingStatus={};
var resultObject={};
var started=false;
var timedOut=false;
var timer=setTimeout(function(){
timedOut=true;
if(typeof(finalCallback)=="function"){
finalCallback(resultObject);
}
@markandey
markandey / monthly-report-time-duration.js
Created Dec 21, 2012
Generates monthly time duration to execute some query, helpful when generating monthly reports.
View monthly-report-time-duration.js
function getCurrentYear(){
return (new Date()).getYear()+1900;
}
function isLeapYear(year) {
var d = new Date(year, 1, 29);
return d.getMonth() == 1;
}
function getMonthDays(month,year){
var monthDays=[31,28,31,30,31,30,31,31,30,31,30,31];
month=month%12;
View htmltomarkdown.js
var toMarkdown = function(string) {
var ELEMENTS = [{
patterns: 'p',
replacement: function(str, attrs, innerHTML) {
return innerHTML ? '\n\n' + innerHTML + '\n' : '';
}
}, {
patterns: 'br',
type: 'void',
replacement: '\n'