is it possible to set a path in the "paths" array inside the apple-app-site-association file that will open only the original domain in the application?
for example,
if my domain is
https://www.example.com
i want the app to be opened if a user clicks a link to
https://www.example.com
but not to
https://www.example.com/a
I didn't test solutions below, so I can't guarantee that they will work. At the same time they all are based on documentation, so they should. I currently don't want to invest time into setting up test environment for this, so that would be nice if you share your test results.
My first suggestion would be just this:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "%YOUR.APP.ID%",
"paths": [
"/"
]
}
]
}
}
If this didn't help, here's another go:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "%YOUR.APP.ID%",
"paths": [
"NOT /?*",
"/*"
]
}
]
}
}
Here ? matches any single character, and * matches any substring, including empty. The idea in the second case is that the system might use the rules from top to bottom.
Because the system evaluates each path in the paths array in the order it is specifiedβand stops evaluating when a positive or negative match is foundβyou should specify high priority paths before low priority paths.
https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html?utm_source=revxblog
The third idea would be to at first exclude all the top level components you know then adding allow all. That might be really overwhelming, especially if you don't control paths or they change.
Related
void main() {
List Users = [
{"Name": "Mohamed", "Age": 21, "Phone": 3303304, "password": "nerkl"},
{"Name": "Ahmed", "Age": 34, "Phone": 2299833, "password": "bftjss"}
];
}
It's just a warning, not an error. The compiler sees your program is if it's completely finished. Since you don't actually use Users yet it gives you the warning, because it means you could delete those lines and it doesn't change the behaviour of your program at all. It's normal to see this a lot while you are still developing. Once you do something with the Users variable the warning will go away. Like if you write a simple
print(Users);
you will notice the warning goes away. Also a small advice: The usual coding conventions are that you don't write variables with a capital letter, this is usually only done for class names. So I would change it to users but that is all up to you.
The variables you declared are never used, only assigned to, therefore you're being warned.
The log4j2 PatternLayout offers a %notEmpty conversion pattern that allows you to skip sections of the pattern that refer to empty variables.
Is there any way to do something similar for JsonTemplateLayout, specifically for thread context data (MDC)? It correctly (IMO) suppresses null fields, but it doesn't do the same with empty ones.
E.g., given the following in my JSON template:
"application": {
"name": { "key": "x-app", "$resolver": "mdc" },
"context": { "key": "x-app-context", "$resolver": "mdc" },
"instance": {
"name": { "key": "x-appinst", "$resolver": "mdc" },
"context": { "key": "x-appinst-context", "$resolver": "mdc" }
}
}
is there a way to prevent blocks like this from being logged, where the only data in the subtree is the empty string values for context?
"application":{"context":"","instance":{"context":""}}
(Yes, ideally I'd prevent those empty strings being put into the context in the first place, but this isn't my app, I'm just configuring it.)
JsonTemplateLayout author speaking here. Currently, JsonTemplateLayout doesn't support blank property exclusion for the following reasons:
The definition of empty/blank is ambiguous. One might have, null, {}, "\s*", [], [[]], [{}], etc. as valid JSON values. Which one of these are empty/blank? Let's assume we have agreed on a certain behavior. Will it apply to the rest of its users?
Checking if a value is empty/blank incurs an extra runtime cost.
Most of the time you don't care. You persist logs in a storage system, e.g., ELK stack, and there blank value elimination is provided out of the box by the storage engine in the most efficient way.
Would you mind sharing your use case, please? Why do you want to prevent the emission of "context": "" properties? If you deliver your logs to Elasticsearch, there you can easily exclude such fields via appropriate index mappings.
Near as I can tell, no. I would suggest you create a Jira issue to get that addressed.
I am using the slack API to get the full list of emoji, so that when I get a message, I will just replace :squirrel: with the icon.
The method https://slack.com/api/emoji.list works like a charm, but returns 30 icons only. I think this is correct since in the documentation page (https://api.slack.com/methods/emoji.list) they say:
This method lists the custom emoji for a team.
Fair enough, but how can I get the full list of the associations icon-name / icon URL ?
I finally managed to get all the icons and to use them and I post here the solution for anyone that would like to use do similar:
First of all, I got the Slack Custom Emoji through this slack URL
Since at step 1 we get only Custom Emojis, it is useful to know that slack uses standard emoji defined in unicode characters, mapped through custom handles like :smiley: or :horse:. The good thing is that we can find, linked through slack page a link to a JSON object with all the emoji mappings. This file is HUGE, but has everything we need.
In the file you'll find an array of javascript object like the one below:
{
"name":"SMILING FACE WITH OPEN MOUTH",
"unified":"1F603",
"variations":[],
"docomo":"E6F0",
"au":"E471",
"softbank":"E057",
"google":"FE330",
"image":"1f603.png",
"sheet_x":26,
"sheet_y":18,"
short_name":"smiley",
"short_names":["smiley"],
"text":":)",
"texts":["=)","=-)"],
"category":"People",
"sort_order":5,
"has_img_apple":true,
"has_img_google":true,
"has_img_twitter":true,
"has_img_emojione":true
}
I used the following information:
shortnames are the names that are used in slack (you'll need to turn smiley into :smiley: )
unified is the unicode character to use (to use it directly in an HTML page you'll need to add &#x so in this case you'll have to use π which is rendered π
Using this information you will be able to create a slack-to-html function to decode emojis and display them wherever you want
Not entirely sure if this is what you are looking for, but if it's just about mapping images to slack-style names, this is a pretty good library:
https://github.com/iamcal/emoji-data
So, building on the example in their README:
The emoji with the Slack style short name point_uphas the hex value 261d, and can thus be found here: https://github.com/iamcal/emoji-data/blob/master/img-apple-160/261d.png
(Apple, because the default slack emoji are the apple emoji)
Just extending on #Luca's awesome solution, I've created a shortnames => html unicode javascript dictionary...
Download: Slack emoticons to unicode html mapping.
Generated - 17th August 2018 from the source https://raw.githubusercontent.com/iamcal/emoji-data/master/emoji.json
Example:
{
"+1": "π",
"-1": "π",
"100": "π―",
"1234": "π’",
"8ball": "π±",
"ab": "π",
"abc": "π€",
"abcd": "π‘",
"accept": "π",
...
"zebra_face": "π¦",
"zipper_mouth_face": "π€",
"zombie": "π§",
"zzz": "π€"
}
Which becomes...
{ "+1": "π", "-1": "π", "100": "π―",
"1234": "π’", "8ball": "π±", "ab": "π",
"abc": "π€", "abcd": "π‘", "accept": "π",
... "zebra_face": "π¦", "zipper_mouth_face": "π€",
"zombie": "π§", "zzz": "π€" }
As far as I know, there is no API endpoint or comprehensive list of supported emoji/keywords available. I was able to grab the full set (including custom emoji for the workspace) by inspecting the Slack emoji picker using React Developer Tools (Chrome extension).
Here's an example (JSON):
...
{
"name": "beers",
"unicode": "1f37b",
"id": "E1f37b",
"keywords": ["bar", "beer", "clink", "drink", "mug", "ale", "food"]
},
{
"name": "baby_bottle",
"unicode": "1f37c",
"id": "E1f37c",
"keywords": ["baby", "bottle", "drink", "milk", "infant"]
},
{
"name": "knife_fork_plate",
"unicode": "1f37d-fe0f",
"id": "E1f37d-fe0f",
"keywords": ["cooking", "fork", "knife", "plate"]
},
{
"name": "champagne",
"unicode": "1f37e",
"id": "E1f37e",
"keywords": ["bar", "bottle", "cork", "drink", "popping"]
},
{ "name": "popcorn", "unicode": "1f37f", "id": "E1f37f", "keywords": [] },
...
Full dump (as of 12/20/2020, excluding custom emoji): https://gist.github.com/impressiver/87b5b9682d935efba8936898fbfe1919
Since it seemed impossible to find a complete and up-to-date source for these emoji names I came up with this browser console script. Just let it run in Slack and when it finishes it will download a full emoji.json. At time of writing it contains 2485 entries.
https://gist.github.com/8461e125072c2806301403a4e1eca891
This looks like this:
{
"+1": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d#2x.png",
"+1::skin-tone-2": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d-1f3fb#2x.png",
"+1::skin-tone-3": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d-1f3fc#2x.png",
"+1::skin-tone-4": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d-1f3fd#2x.png",
If you want the actual emoji instead of the image you can parse that out of the image file name, e.g. 1f44d-1f3fd#2x.png is "\u1f44d\u1f3fd".
When searching for keywords and keyword suggestions, there are some keywords that facebook returns, such as "#Dude, Where's My Car?" that have commas in them. While trying to validate them, these keywords get split in two. I've tried a number of things from slashes to urlencode to keep them from getting separated, but I haven't been successful. Anyone have any ideas?
The below url part returns valid for every keyword but not for %23Dude%2c+Where%27s+My+Car%3f
search?type=adkeywordvalid&keyword_list=Hey+Dude+Wheres+My+Car,Dude+Where+Is+My+Car,Dude+Wheres+My+Car,%23Dude%2c+Where%27s+My+Car%3f,Dude+Wheres+My+Car+Then,Dude+Where039s+My+Car,%23The+Hangover,%23Harold+%26+Kumar+Go+to+White+Castle
Turns out it's not so much a bug as a documentation issue.
You just need to surround the keyword by urlencoded quotes AND square brackets:
["#Dude, Where's My Car?"]
becomes
%5B%22%23Dude%2C%20Where's%20My%20Car%3F%22%5D
... and the result is correct:
{
"data": [
{
"name": "#Dude, Where's My Car?",
"valid": true,
"id": "6003406131991"
}
]
}
I want to make a new key binding to change syntax to, let's say, HTML or CSS. I searched the official and unofficial documentation to see if there are any answers to my problem.
Use the following key combination to pull up the command palette:
Ctrl+Shift+P
then type:
sshtml (for example, to set the syntax to HTML)
This is how i roll, if that's what you meant exaclty:
// Syntax Change
{"keys": ["alt+shift+h"], "command": "set_file_type",
"args": {"syntax": "Packages/HTML/HTML.tmLanguage"}
},
{"keys": ["alt+shift+m"], "command": "set_file_type",
"args": {"syntax": "Packages/Markdown/Markdown.tmLanguage"}
},
{"keys": ["alt+shift+p"], "command": "set_file_type",
"args": {"syntax": "Packages/PHP/PHP.tmLanguage"}
},
{"keys": ["alt+shift+j"], "command": "set_file_type",
"args": {"syntax": "Packages/Javascript/JSON.tmLanguage"}
},
There is an easy way to do that.
On the right bottom, there is a button, click on that button you will get all the available syntax.
You can use the Command Pallet (ctrl + shift + p) to change the Syntax, but sometimes using "ss" or "sshtml" brings up other commands that are un-related to the "Set Syntax" options.
You can also add a new Key Binding User Preference that brings up the Command Pallet with the text "Set Syntax: " already in it. Then you just have to type the language you want to set it to.
To setup this key-binding shortcut:
Open the Command Pallet (ctrl + shift + p)
Find and select the "Preferences: Key Bindings" option
Update your User ".sublime-keymap" file to have the "keys" json-object listed in the array:
[
"// additonal/exsiting key comands go here...",
{ "keys": ["ctrl+alt+l"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Set Syntax: "} }
]
Now you can use ctrl+alt+l to bring up the command prompt. Then just type HTML, CSS, or whatever language you're looking to switch too.
Feel free to change the "keys" combination from ctrl+alt+l to anything else you want the shortcut to be too.
dzhi's answer doesnt work anymore for JSON in Sublime 4.
The correct path is
Packages/JSON/JSON.tmLanguage