This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function isThisFile(url: string): boolean { | |
let formattedFilename = figma.root.name.trim() | |
formattedFilename = encodeURIComponent(formattedFilename).replace(/%20/g, '-') | |
let isThisFile = url.includes('figma.com') && url.includes(formattedFilename) | |
return isThisFile | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function getNodeIdFromUrl(url: string): string | null { | |
url = url.toLowerCase() | |
let startIndex: number = url.indexOf('node-id=') + 8 | |
let endIndex: number = url.indexOf('&', startIndex) | |
if (startIndex) { | |
if (endIndex > 0) { | |
return url.substring(startIndex, endIndex).replace('%3a', ':') | |
} else { | |
return url.substring(startIndex).replace('%3a', ':') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* In your config.h define a new variable RGBLIGHT_TIMEOUT and give it a value in milliseconds */ | |
#define RGBLIGHT_SLEEP // allows us to use rgblight_suspend() and rgblight_wakeup() in keymap.c | |
#define RGBLIGHT_TIMEOUT 30000 // 30 seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# wait-for-nlu.sh | |
set -e | |
host="$1" | |
shift | |
cmd="$@" | |
http_status="$(curl -s -o /dev/null -I -w "%{http_code}" http://www.webserver.com:8080/)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creating a handler which executes runnables immediately | |
Mockito.when(uiHandler.post(Mockito.any(Runnable.class))).thenAnswer( | |
new Answer<Object>() { | |
@Override | |
public Object answer(InvocationOnMock invocation) throws Throwable { | |
Runnable msg = invocation.getArgument(0); | |
msg.run(); | |
return null; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright {2017} {Aashrey Kamal Sharma} | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A simple class for managing application migration across updates. | |
* | |
* Created by aashreys on 24/04/17. | |
*/ | |
public class Migrator { | |
private static final String KEY_LAST_VERSION = "migrator_key_last_version"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AspectRatioImageView extends ImageView { | |
private float widthToHeightRatio; | |
public AspectRatioImageView(Context context) { | |
super(context); | |
} | |
public AspectRatioImageView(Context context, AttributeSet attrs) { | |
super(context, attrs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<dimen name="spacing_xxs">2dp</dimen> | |
<dimen name="spacing_xs">4dp</dimen> | |
<dimen name="spacing_small">8dp</dimen> | |
<dimen name="spacing_medium">16dp</dimen> | |
<dimen name="spacing_large">24dp</dimen> | |
<dimen name="spacing_xl">32dp</dimen> | |
<dimen name="spacing_xxl">48dp</dimen> | |
<dimen name="spacing_xxxl">72dp</dimen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EndlessScrollAdapter extends RecyclerView.Adapter<EndlessScrollAdapter.ImageViewHolder> { | |
private static final String TAG = EndlessScrollAdapter.class.getSimpleName(); | |
private int loadingThreshold = 5; // Default value | |
private LoadMoreCallback loadMoreCallback; | |
public EndlessScrollAdapter() {} |
NewerOlder