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 / gist:a7789578f18754c2b8ddfb69e191abd6
Created January 10, 2019 00:22 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream

Contributing To WordPress (Using Git)

December 10, 2012

More and more people are realizing that git is awesome. Although the official WordPress source code still lives in an svn repository, you can contribute patches without having to touch svn ever again.

So, without further ado, here’s how you can generate and manage patches for WordPress Core (it assumes you’re comfortable with the command line).

1. Find a ticket to work on.

@geminorum
geminorum / .editorconfig
Last active July 30, 2019 14:13
dot files
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
@geminorum
geminorum / weeknumber.js
Created October 21, 2018 18:11
Week numbers in JavaScript
/// How to get the week number from a date
// The code below adds two new functions to the Date object. Add this to your source code.
// To get the ISO week number (1-53) of a Date object, mydate, use mydate.getWeek().
// To get the corresponding four-digit year, use mydate.getWeekYear().
// This script is released to the public domain and may be used, modified and
// distributed without restrictions. Attribution not necessary but appreciated.
// @SOURCE: https://weeknumber.net/how-to/javascript
// Returns the ISO week of the date.
@geminorum
geminorum / wpcf7-bs.html
Last active December 22, 2020 01:05
Contact Form 7 with Bootstrap
<div class="row">
<div class="col-md-6 mb-4">
[text* your-name akismet:author class:form-control placeholder "نام (ضروری)"]
</div>
<div class="col-md-6 mb-4">
[email* your-email akismet:author_email class:form-control placeholder "ایمیل (ضروری)"]
</div>
<div class="col-md-12 mb-4">
@geminorum
geminorum / company-code-IR.php
Last active July 30, 2019 14:13
شناسه ملی شرکت
<?php
// @REF: https://github.com/DevRoomOrg/ircheck/issues/1#issuecomment-348672401
// @REF: http://www.aliarash.com/article/shenasameli/shenasa_meli.htm
function checkNationalCode($nationalCode) {
if (strlen($nationalCode) != 11)
return false;
$c = intval(substr($nationalCode, 10, 1));
@geminorum
geminorum / numbred-sprintf.js
Last active October 10, 2017 23:30 — forked from rmariuzzo/sprintf.js
Javascript sprintf
// @SOURCE: https://stackoverflow.com/a/4673436/4864081
// First, checks if it isn't implemented yet.
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
علی آرش خداداد ۱۳۸۴
کد ۱۲۸ امکان کد گذاری همهٔ ۱۲۸ حرف مربوط به مجموعه کاراکترهای کد اسکی را ارائه می‌کند. این کد با استفاده از خطوط و فضاهای خالی با ۴ پهنای مختلف، به بیشترین فشردگی ممکن سمبل‌ها نسبت به روش‌های قدیمی‌تر خود که از خطوط و فضاهای خالی با ۲ ضخامت مختلف استفاده می‌کردند، رسیده است

کد ۱۲۸ ممکن است به صورت دو طرفه (از هر دو جهت) اسکن شود و محدودیتی هم برای تعداد کاراکترها در هر بارکد وجود ندارد. هر چند ممکن است طول بارکد با توجه به نوع اسکنر مورد استفاده و یا مکان مورد نظر برای چاپ بارکد محدود شود. اما این روش محدودیتی برای طول بارکد ایجاد شده ندارد.

کد ۱۲۸ سه مجموعه کاراکتری متفاوت دارد که در جدول مشخصات بارکد به نام‌های Code Set A و Code Set B و Code Set C مشخص شده است. هر کدام از این سه مجموعه کد می‌تواند با کاراکتر شروع مربوط به خودش مورد انتخاب واقع شود. کاراکتر خاص «shift» در هر مجموعه به شما امکان می‌دهد تا بتوانید در بین یک کد ست از کد ست‌های

@geminorum
geminorum / PHP-Strings.md
Created April 2, 2017 00:46
What is the difference between single-quoted and double-quoted strings in PHP?

PHP strings can be specified not just in two ways, but in four ways.

  1. Single quoted strings will display things almost completely "as is." Variables and most escape sequences will not be interpreted. The exception is that to display a literal single quote, you can escape it with a back slash \', and to display a back slash, you can escape it with another backslash \\ (So yes, even single quoted strings are parsed).
  2. Double quote strings will display a host of escaped characters (including some regexes), and variables in the strings will be evaluated. An important point here is that **you can use curly braces to iso
@geminorum
geminorum / google_jsapi.php
Created November 27, 2016 22:10 — forked from franz-josef-kaiser/google_jsapi.php
WordPress plugin to add a Google Pie Charts / Visualization in a MetaBox.
<?php
namespace WPSE;
/** Plugin Name: Google JSAPI test plugin */
add_action( 'admin_enqueue_scripts', __NAMESPACE__.'\addScripts' );
function addScripts()
{
wp_enqueue_script(