Skip to content

Instantly share code, notes, and snippets.

View talismandev's full-sized avatar

talismandev talismandev

View GitHub Profile
@dalezak
dalezak / README.md
Last active September 11, 2023 09:51
Ionic Capacitor Resources Generator
  1. Run npm install cordova-res --save-dev
  2. Create 1024x1024px icon at resources/icon.png
  3. Create 2732x2732px splash at resources/splash.png
  4. Add "resources": "cordova-res ios && cordova-res android && node scripts/resources.js" to scripts in package.json
  5. Copy resources.js file to scripts/resources.js
  6. Run sudo chmod -R 777 scripts/resources.js
  7. Run npm run resources
def answer_types do
:code.all_loaded()
# turn everything into a string
|> Enum.map(&(elem(&1, 0) |> to_string))
# take only the modules that are scoped under AnswerType
|> Enum.filter(&Regex.match?(~r/YourModuleName./, &1))
# take the last element from the list (i.e ["ModuleParent", "Child"])
|> Enum.map(&(String.split(&1, ".") |> Enum.take(-1)))
# there may be duplicates
|> Enum.uniq()
@sandcastle
sandcastle / copy-to-clipboard.ts
Created July 17, 2017 06:38
A copy to clipboard function (in typescript)
export const copyToClipboard = (url: string) => {
document.addEventListener('copy', (e: ClipboardEvent) => {
e.clipboardData.setData('text/plain', url);
e.preventDefault();
document.removeEventListener('copy');
});
document.execCommand('copy');
};