1
0

snippets.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <main class="">
  3. <header class="bg-indigo-900">
  4. <!-- Header section with select menu -->
  5. <div class="max-w-2xl mx-auto py-16 px-4 sm:py-24 sm:px-6 lg:px-8 lg:max-w-7xl">
  6. <div class="px-0 sm:px-4 lg:px-0 lg:flex lg:justify-between lg:items-center">
  7. <div class="max-w-xl">
  8. <h2 class="text-4xl font-extrabold text-gray-100 sm:text-5xl sm:tracking-tight lg:text-6xl">
  9. Code Snippets
  10. </h2>
  11. <p class="mt-5 text-xl text-indigo-300">
  12. Browse &amp; search our extensive library of <span class="text-gray-100 font-medium">fully-audited, drop-in functions</span> to use in your Crypto projects.
  13. </p>
  14. </div>
  15. <div class="mt-10 w-full max-w-xs lg:mt-0">
  16. <label for="currency" class="block text-base font-medium text-indigo-300">
  17. CHOOSE YOUR PLATFORM
  18. </label>
  19. <div class="mt-1.5 relative">
  20. <select id="currency" name="currency" class="block w-full bg-none bg-indigo-400 bg-opacity-25 border border-transparent text-white focus:ring-white focus:border-white rounded-md">
  21. <option class="bg-gray-900">Binance Smart Chain (BSC)</option>
  22. <option class="bg-gray-900">Ethereum (ETH)</option>
  23. <option class="bg-gray-900" selected>Smart Bitcoin (sBCH)</option>
  24. </select>
  25. <div class="pointer-events-none absolute inset-y-0 right-0 px-2 flex items-center">
  26. <!-- Heroicon name: solid/chevron-down -->
  27. <svg class="h-4 w-4 text-indigo-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
  28. <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
  29. </svg>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </header>
  36. <section class="py-10 max-w-5xl mx-auto">
  37. <h1 class="mt-5 text-3xl font-bold">
  38. Math.sol
  39. <small class="text-xs text-gray-500 uppercase">Solidity</small>
  40. </h1>
  41. <div class="mt-3 p-5 font-medium bg-gray-100 border-4 border-gray-300 rounded-xl">
  42. A library for performing various math operations.
  43. </div>
  44. <pre class="mt-5 p-5 bg-yellow-100 border-4 border-yellow-300 rounded-xl">
  45. <code>pragma solidity =0.5.16;
  46. // a library for performing various math operations
  47. library Math {
  48. function min(uint x, uint y) internal pure returns (uint z) {
  49. z = x &lt; y ? x : y;
  50. }
  51. // babylonian method
  52. // (see: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
  53. function sqrt(uint y) internal pure returns (uint z) {
  54. if (y > 3) {
  55. z = y;
  56. uint x = y / 2 + 1;
  57. while (x &lt; z) {
  58. z = x;
  59. x = (y / x + x) / 2;
  60. }
  61. } else if (y != 0) {
  62. z = 1;
  63. }
  64. }
  65. }
  66. </code></pre>
  67. </section>
  68. </main>
  69. </template>
  70. <script>
  71. export default {
  72. data: () => {
  73. return {
  74. //
  75. }
  76. },
  77. head: () => ({
  78. title: 'Code Snippets — APECS Dev',
  79. meta: [
  80. {
  81. hid: 'description', // `vmid` for it as it will not work
  82. name: 'description',
  83. content: `Code Snippets`
  84. }
  85. ]
  86. }),
  87. created: async function () {
  88. /* Retrieve session. */
  89. // const session = await this.hasSession()
  90. // .catch(err => console.error('Session Error:', err))
  91. /* Validate session. */
  92. // if (!session) {
  93. // return
  94. // }
  95. },
  96. mounted: function () {
  97. //
  98. },
  99. }
  100. </script>