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
package main | |
import ( | |
"database/sql/driver" | |
"encoding/json" | |
"github.com/jinzhu/gorm" | |
_ "github.com/lib/pq" | |
) |
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
function t(){return document.querySelector("script[data-weedle-id]").getAttribute("data-weedle-id")}function e(){var e=new XMLHttpRequest;e.open("GET","https://swapi.dev/api/people/1"),e.send(),e.onreadystatechange=function(){4===this.readyState&&200===this.status&&console.log(JSON.parse(e.responseText))}}function n(t){var e=document.createElement("script");e.src="https://cdn.jsdelivr.net/npm/@metamask/[email protected]/dist/metamask-onboarding.bundle.js",e.async=!0,document.body.appendChild(e),e.addEventListener("load",function(){console.log("metamask script added",t);var e=new MetaMaskOnboarding;t.disabled=!0,e.startOnboarding()}),e.onerror=function(e){console.log(e),alert("Could not setup metamask, please refresh the page!")}}function o(e){void 0!==window.ethereum?ethereum.isMetaMask&&(ethereum.request({method:"eth_requestAccounts"}).then(function(e){console.log({accounts:e}),document.getElementById("-wdl-crypto-account").textContent+=e[0]}).catch(function(e){console.log(e)}),ethereum.on("accountsChanged",e |
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
pragma solidity ^0.4.11; | |
/** | |
* Math operations with safety checks | |
*/ | |
library SafeMath { | |
function mul(uint a, uint b) internal returns (uint) { | |
uint c = a * b; | |
assert(a == 0 || c / a == b); | |
return c; |
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
# Redis Cheatsheet | |
# All the commands you need to know | |
redis-server /path/redis.conf # start redis with the related configuration file | |
redis-cli # opens a redis prompt | |
# Strings. |
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
#!/usr/bin/env bash | |
# This script is meant to build and compile every protocolbuffer for each | |
# service declared in this repository (as defined by sub-directories). | |
# It compiles using docker containers based on Namely's protoc image | |
# seen here: https://github.com/namely/docker-protoc | |
set -e | |
REPOPATH=${REPOPATH-/opt/protolangs} | |
CURRENT_BRANCH=${CIRCLE_BRANCH-"branch-not-available"} |
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
// Note i skipped a lot of steps here like starting a server etc | |
require('dotenv').config() | |
const redis = require('redis') | |
const sub = redis.createClient(); | |
const cp = require('child_process'); | |
const glob = require('glob'); | |
glob('!(node_modules)/**/*.worker.js', function (er, files) { // Ignore all workers in node_modules and use only those defined within my app | |
for (let f of files) { |
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
const BaseQueue = require('./base_worker') | |
const userModel = require('../models/userModel') | |
class UserWorker extends BaseQueue { | |
constructor () { | |
super('users', userModel) | |
} | |
runQueue () { | |
super.runQueue() |
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
require('dotenv').config() | |
const redis = require('redis') | |
const QueueHelper = require('../../util/rabbitmq.helper'); | |
const modelContainer = require('../models') | |
const pub = redis.createClient(); // creating for localhost | |
class BaseWorker { | |
constructor (type, model) { | |
this.type = type | |
this.QueueName = `${type}:queue` |
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
const rabbitMq = require('amqplib'); | |
class RabbitMqHelper { | |
constructor (channel_name) { | |
this.channel = null; | |
this.connection = null; | |
this.queueAssert = null; | |
this.channel_name = channel_name | |
} |
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
const git = require('nodegit') | |
const fs = require('fs-extra') | |
const { URL } = require('url') | |
const REPO_URL = '[email protected]:org/path.git' | |
const CLONE_DIR = '/tmp/private-repo-clone-test' | |
;(async () => { | |
await fs.emptyDir(CLONE_DIR) | |
let authAttempted = false | |
await git.Clone.clone(REPO_URL, CLONE_DIR, { |
NewerOlder