Skip to content

Instantly share code, notes, and snippets.

View mm580486's full-sized avatar
🎯
Focusing

mohammad mahmoodi mm580486

🎯
Focusing
View GitHub Profile
def create_login_key(name, value, options = {})
never_expires = options.fetch(:never_expires, true)
expiration = options[:expiration]
allow_htm = options.fetch(:allow_htm, true)
allowed_commands = options.fetch(:allowed_commands, ['ALL_*'])
@mm580486
mm580486 / dsfs.js
Last active October 10, 2019 15:53
var STATES_LIST = JSON.parse($('#state_codes').text());
function initStates() {
STATES_LIST.forEach(function(item, index) {
var newOption = new Option(item.name, item.state_code, false, false);
$('#states').append(newOption).trigger('change');
})
}
var STATES = JSON.parse($('#states').text());
function initStates() {
states.forEach(function(item, index) {
var newOption = new Option(item.PNAME, item.STATE_CODE, false, false);
$('#states').append(newOption).trigger('change');
})
}
var states = [{
"STATE_CODE": 31,
"PNAME": "البرز",
"ENAME": "Alborz"
}, {
"STATE_CODE": 1,
"PNAME": "تهران",
"ENAME": "Tehran"
$('input[type=radio][name=paymentMethod]').change(function() {
var radio = $(this);
var weight = $('.weight').text();
var price = $('.client-shop-all-price').text();
var request = $.ajax({
url: "https://newkhat.khatoghalam.com/api/shop/v1/add-to-cart",
type: "POST",
cache: false,
data: {
@mm580486
mm580486 / remove-emoji.rb
Last active January 27, 2021 14:30
remove emoji from string - ruby
# method base
def clean_emoji(str='')
str=str.force_encoding('utf-8').encode
arr_regex=[/[\u{1f600}-\u{1f64f}]/,/[\u{2702}-\u{27b0}]/,/[\u{1f680}-\u{1f6ff}]/,/[\u{24C2}-\u{1F251}]/,/[\u{1f300}-\u{1f5ff}]/]
arr_regex.each do |regex|
str = str.gsub regex, ''
end
return str
end
# sample

Keybase proof

I hereby claim:

  • I am mm580486 on github.
  • I am mm580486 (https://keybase.io/mm580486) on keybase.
  • I have a public key whose fingerprint is 5F4D 8C59 1AB5 8E19 467E 03E0 AEA5 406C 03D0 CC17

To claim this, I am signing this object: