Skip to content

Instantly share code, notes, and snippets.

View gdeglin's full-sized avatar
🚀

George Deglin gdeglin

🚀
View GitHub Profile
@gdeglin
gdeglin / reasons.md
Last active May 26, 2023 11:55
Reasons an FCM notification can be delayed

Reason 1: Force Stopped

When an app is in a "Force Stopped" state most events including FCM/GCM messages for push notifications will not be received.

An app can be placed in this state in the following ways.

  • From Settings > Apps, "Force Stop" is pressed.
  • Long pressing the back button on some devices.
  • Using a 3rd party task killer like Greenify.
  • App is closed on a Huawei or Xiaomi device due their custom Android tweaks.
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
<head>
<link rel="manifest" href="manifest.json">
<script>
var OneSignal = OneSignal || [];
OneSignal.push(["init", {path: '/', appId: "[Your OneSignal App ID]", autoRegister: false}]);
</script>
</head>
#!/bin/bash
#
## redis backup script
## usage
## redis-backup.sh port backup.dir
port=${1:-6379}
backup_dir=${2:-"/data/backup/redis"}
cli="/usr/local/bin/redis-cli -p $port"
static NSString * AFNormalizedDeviceTokenStringWithDeviceToken(id deviceToken) {
return [[[[deviceToken description] uppercaseString] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]] stringByReplacingOccurrencesOfString:@" " withString:@""];
}
@gdeglin
gdeglin / gist:4128882
Created November 22, 2012 01:23
LUA UTF8 String functions
-- Provides UTF-8 aware string functions implemented in pure lua:
-- * string.utf8len(s)
-- * string.utf8sub(s, i, j)
--
-- All functions behave as their non UTF-8 aware counterparts with the exception
-- that UTF-8 characters are used instead of bytes for all units.
--
-- Note: all validations had been removed due to awesome usage specifics.
--[[
Copyright (c) 2006-2007, Kyle Smith
C:\Users\George>c:/ruby/bin/irb
irb(main):001:0> require 'time'
=> true
irb(main):002:0> Time.parse('01-02-2010').to_s
=> "Mon Feb 01 00:00:00 -0800 2010"
irb(main):003:0> Time.parse('01/02/2010').to_s
=> "Sat Jan 02 00:00:00 -0800 2010"
irb(main):004:0> Time.parse('01-02-1800')
ArgumentError: argument out of range
from c:/Ruby/lib/ruby/1.8/time.rb:184:in `local'
function ajax_plain_text(target_element) {
Ajax.Update(target_element, 'RAW', '/ajax/server_time_raw')
}