Skip to content

Instantly share code, notes, and snippets.

View faisalman's full-sized avatar
👉
Hire me! #OPENTOWORK

Faisal Salman faisalman

👉
Hire me! #OPENTOWORK
View GitHub Profile
@faisalman
faisalman / example.js
Last active June 4, 2020 12:02
7-bit GSM 03.38 <-> Unicode Map in JS
// Unicode to 7-bit GSM
var write = "Hello, Faisalman!";
var msgSubmit = "";
write.split('').forEach(function(i) {
msgSubmit += parseInt(Unicode2GSM[i], 10).toString(16).toUpperCase() + " ";
});
console.log(msgSubmit); // "48 65 6C 6C 6F 2C 20 46 61 69 73 61 6C 6D 61 6E 21 "
// 7-bit GSM to Unicode
var read = "48 65 6C 6C 6F 2C 20 46 61 69 73 61 6C 6D 61 6E 21 ";
@faisalman
faisalman / baseConverter.js
Last active January 11, 2023 14:43
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@faisalman
faisalman / get_weekth.php
Created May 10, 2012 09:55
Get ISO-8601 week number for a given date in PHP
<?php
/**
* Get ISO-8601 week number for a given date
*
* @author Faisalman <fyzlman@gmail.com>
* @link http://gist.github.com/faisalman
* @link http://en.wikipedia.org/wiki/ISO_week_date
* @param $y int year
* @param $m int month
* @param $d int day
@faisalman
faisalman / Age.cs
Last active June 8, 2023 11:40
Calculate Age (Years + Months + Days) in C#
/**
* Calculate Age in C#
* https://gist.github.com/faisalman
*
* Copyright 2012-2013, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
using System;
@faisalman
faisalman / example.html
Created June 4, 2011 22:42
HTML markup for adding popular social sharing buttons (Tweet, Share, & +1)
<!--
1. Google +1 button
- see http://www.google.com/webmasters/+1/button/
-->
<g:plusone size="medium"></g:plusone>
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
<!--
2. Twitter Tweet button
- see http://twitter.com/about/resources/tweetbutton/
@faisalman
faisalman / analytics-regexp.js
Created April 18, 2011 08:06
Regular Expression snippets to validate Google Analytics tracking code (in PHP, JavaScript)
/**
* Regular Expression snippets to validate Google Analytics tracking code
* see http://code.google.com/apis/analytics/docs/concepts/gaConceptsAccounts.html#webProperty
*
* @author Faisalman <movedpixel@gmail.com>
* @license http://www.opensource.org/licenses/mit-license.php
* @link http://gist.github.com/faisalman
* @param str string to be validated
* @return Boolean
*/
@faisalman
faisalman / print_r.js
Last active September 13, 2021 02:57
PHP-like print_r() & var_dump() equivalent for JavaScript
/**
* PHP-like print_r() equivalent for JavaScript Object
*
* @author Faisalman <fyzlman@gmail.com>
* @license http://www.opensource.org/licenses/mit-license.php
* @link http://gist.github.com/879208
*/
var print_r = function (obj, t) {
// define tab spacing
@faisalman
faisalman / XML2003Parser.php
Created March 9, 2011 19:00
PHP class for parsing Microsoft Excel 2003 XML Spreadsheet
<?php
/**
* Excel 2003 XML-Parser
*
* PHP library for parsing Microsoft Excel 2003 XML Spreadsheet
* http://gist.github.com/862741
*
* Copyright (c) 2011 Faisalman <movedpixel@gmail.com>
*
@faisalman
faisalman / Rupiah.as
Created February 26, 2011 15:35
Konversi Angka ke format Rupiah & vice versa (C#, PHP, JavaScript, ActionScript 3.0)
package
{
/**
* ActionScript 3.0 Code Snippet
* Convert Number to Rupiah & vice versa
* https://gist.github.com/845309
*
* Copyright 2011-2012, Faisalman
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license