This file contains 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
// modify/duplicate the other snippets in this group, using | |
// the abbreviation to define words to replace with "swear" characters | |
function censor (input) { | |
var badWord = input.replace(/((er)?s?|ing)?$/, ''); | |
return input.replace(badWord, censored(badWord)); | |
} | |
function shuffleArray(inputArr) { | |
var array = inputArr.slice(0); |
This file contains 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/env ruby | |
# encoding: utf-8 | |
# Marked 2 preprocessor | |
# Allows use of `*` link references where the next [*]: href defines the link | |
# Inspired by [tidbits][*] | |
# [*]: http://tidbits.com | |
if RUBY_VERSION.to_f > 1.8 | |
input = STDIN.read.force_encoding('UTF-8') | |
else | |
input = STDIN.read |
This file contains 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/env ruby | |
# encoding: utf-8 | |
=begin | |
http://marked2app.com | |
Marked 2 preprocessor - "Lazy" footnotes. | |
Allows use of `[^]` or `†` footnote references | |
where the next [^]: or †: note defines the text of the footnote. |
This file contains 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 JSON_stringify(s, emit_unicode) | |
{ | |
var json = JSON.stringify(s); | |
return emit_unicode ? json : json.replace(/[\u007f-\uffff]/g, | |
function(c) { | |
return '\\u'+('0000'+c.charCodeAt(0).toString(16)).slice(-4); | |
} | |
); | |
} |
This file contains 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
<div class="someclass notip">notip</div> | |
<div class="someclass">not notip</div> |
This file contains 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
//Javascript implementation of utf8_encode function from php. | |
function utf8_encode(argString) { | |
if (argString === null || typeof argString === 'undefined') { | |
return ''; | |
} | |
var string = (argString + ''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n"); | |
var utftext = '', | |
start, end, stringl = 0; |
This file contains 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
// first of all make sure we have enough arguments (exit if not) | |
if (process.argv.length != 5) | |
{ | |
console.error("Usage: node csv2html.js input.csv template.ejs output.html") | |
console.error(); | |
console.error("Outputs the given template for each row in the given input.") | |
console.error("Uses the first row of the CSV as column names in the template.") | |
process.exit(1); | |
} |
This file contains 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
<div id="insertTest"></div> | |
<script> | |
var wikipediaHTMLResult = function(data) { | |
var readData = $('<div>' + data.parse.text.* + '</div>'); | |
// handle redirects | |
var redirect = readData.find('li:contains("REDIRECT") a').text(); | |
if(redirect != '') { | |
callWikipediaAPI(redirect); |
This file contains 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
//Based on gulpfile.js from Google Web Starter Kit. | |
//https://github.com/google/web-starter-kit | |
'use strict'; | |
// Include Gulp & Tools We'll Use | |
var gulp = require('gulp'); | |
var $ = require('gulp-load-plugins')(); | |
var del = require('del'); | |
var runSequence = require('run-sequence'); | |
var browserSync = require('browser-sync'); |
This file contains 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
%% Copyright | |
-module(jalali). | |
-author("jrad <behradz@gmail.com>"). | |
-define( G_DAYS_IN_MONTH, [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ] ). | |
-define( J_DAYS_IN_MONTH, [ 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29 ] ). | |
%% API | |
-export([ | |
gregorian_to_jalali/1, |