Skip to content

Instantly share code, notes, and snippets.

View geminorum's full-sized avatar
🏠
Working from home

Nasser Rafie geminorum

🏠
Working from home
View GitHub Profile
@geminorum
geminorum / TECensor.js
Created May 4, 2016 13:56 — forked from ttscoff/TECensor.js
A &#%$ing JavaScript snippet for TextExpander to automatically censor naughtiness with !%@#. #!@& that's cool.
// 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);
@geminorum
geminorum / lazylink.rb
Created May 4, 2016 13:34 — forked from ttscoff/lazylink.rb
Marked 2 Preprocessor for "lazy links"
@geminorum
geminorum / lazyfootnotes.rb
Created May 4, 2016 13:32 — forked from ttscoff/lazyfootnotes.rb
Lazy footnotes for Markdown, based on TidBits lazy link style
#!/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.
@geminorum
geminorum / json.stringify.js
Created April 30, 2016 07:08 — forked from composite/json.stringify.js
JSON stringify with escape unicode characters. http://stackoverflow.com/a/4901205/489575
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);
}
);
}
@geminorum
geminorum / SassMeister-input-HTML.html
Created April 22, 2016 12:23 — forked from roubaobaozi/SassMeister-input-HTML.html
Generated by SassMeister.com.
<div class="someclass notip">notip</div>
<div class="someclass">not notip</div>
@geminorum
geminorum / utf8_encode.js
Created April 21, 2016 11:16 — forked from phpmypython/utf8_encode.js
Implementation of utf8_encode in javascript
//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;
@geminorum
geminorum / csv2html.js
Created March 18, 2016 22:23 — forked from RandomEtc/csv2html.js
Quick node.js script to convert a CSV file to HTML
// 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);
}
@geminorum
geminorum / index.html
Created November 3, 2015 01:03 — forked from steren/index.html
call Wikipedia API using jQuery and parse result
<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);
//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');
@geminorum
geminorum / jalali.erl
Last active August 29, 2015 14:23 — forked from behrad/jalali.erl
%% 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,