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
#!/usr/bin/php | |
<?php | |
if (empty($argv[1]) || empty($argv[2])) { die ("Usage: $argv[0] <xml-file> <xsl-file>\n"); } | |
$xmlFile = $argv[1]; | |
$xslFile = $argv[2]; | |
$dom = new domDocument(); | |
$dom->load($xslFile); | |
$proc = new xsltprocessor; |
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 [a,b]=linlsq(X,Y) | |
[n,m]=size(X); | |
n=n*m; | |
sumx = sum(X); | |
sumy = sum(Y); | |
sumxx = sum(X.*X); | |
sumxy = sum(X.*Y); | |
a=(sumx*sumy-n*sumxy)/(sumx*sumx-n*sumxx); | |
b=(sumy-a*sumx)/n; | |
endfunction |
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
@echo off | |
color 0A | |
title Conditional Shutdown | |
:start | |
echo What would you like to do? | |
echo. | |
echo 1. Shutdown in specified time | |
echo 2. Shutdown now | |
echo 3. Restart now |
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
distinct-values(//tp:treatment-sec/@sec-type/lower-case(.)) |
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
<input type="text" name="locations" list="places"> | |
<datalist id="places"> | |
<option>Amman, Jordan</option> | |
<option>New York, NY, USA</option> | |
<option>Paris, France</option> | |
<option>Vienna, Austria</option> | |
</datalist> | |
<!-- https://docs.webplatform.org/wiki/html/elements/datalist --> |
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
namespace ExpressionTest | |
{ | |
using System; | |
using System.Linq.Expressions; | |
public static class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
string str = "Test"; |
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
/// <summary> | |
/// Converts XmlDocument to XDocument. | |
/// Original source: <see cref="http://stackoverflow.com/questions/1508572/converting-xdocument-to-xmldocument-and-vice-versa"/> | |
/// </summary> | |
/// <param name="xmlDocument">XmlDocument instance to be converted.</param> | |
/// <returns></returns> | |
public static XDocument XmlToXDocument(this XmlDocument xmlDocument) | |
{ | |
using (XmlNodeReader nodeReader = new XmlNodeReader(xmlDocument)) | |
{ |
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
/// <summary> | |
/// Converts XDocument to XmlDocument. | |
/// Original source: <see cref="http://stackoverflow.com/questions/1508572/converting-xdocument-to-xmldocument-and-vice-versa"/> | |
/// </summary> | |
/// <param name="document">XDocument instance to be converted.</param> | |
/// <returns></returns> | |
public static XmlDocument XToXmlDocument(this XDocument document) | |
{ | |
XmlDocument xmlDocument = new XmlDocument(); | |
using (XmlReader xmlReader = document.CreateReader()) |
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
/// <summary> | |
/// Deserializes XmlDocument object to Serializable object of type T. | |
/// </summary> | |
/// <typeparam name="T">Serializable object type as output type.</typeparam> | |
/// <param name="document">XmlDocument object to be deserialized.</param> | |
/// <returns>Deserialized serializable object of type T.</returns> | |
public static T Deserialize<T>(this XmlDocument document) | |
where T : class | |
{ | |
XmlReader reader = new XmlNodeReader(document); |
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
// source: https://blog.heroku.com/kafka-data-pipelines-frp-node?c=7013A000000tyBBQAY&utm_campaign=Newsletter_December_2016&utm_medium=email&utm_source=newsletter&utm_content=blog&utm_term=kafka-data-pipelines-frp-node | |
function wordFreq(accumulator, string) { | |
return _.replace(string, /[\.!\?"'#,\(\):;-]/g, '') //remove special characters | |
.split(/\s/) | |
.map(word => word.toLowerCase()) | |
.filter(word => ( !_.includes(stopWords, word) )) //dump words in stop list | |
.filter(word => ( word.match(/.{2,}/) )) //dump single char words | |
.filter(word => ( !word.match(/\d+/) )) //dump all numeric words | |
.filter(word => ( !word.match(/http/) )) //dump words containing http | |
.filter(word => ( !word.match(/@/) )) //dump words containing @ |
OlderNewer