Skip to content

Instantly share code, notes, and snippets.

Avatar

$quirrel Tzikas

View GitHub Profile
@ross-u
ross-u / README.md
Created Nov 23, 2019
Heroku Deployment (with Mongo Atlas) - ExpressJS + Handlebars
View README.md

Heroku Deployment - with Mongo Atlas


Benefit of deploying a Heroku free dyno and using Mongo Atlas for your MongoDB is that you are not required to use a credit card during the sign up. The process of setting up a DB cluster with Mongo Atlas takes a bit longer than it would be if you are using the Heroku's MLab add-on (free sandbox).


View vscode-shortcuts.md

VS Code shortcuts

  • Search text through all files at once

    • Mac: Command + Shift + f
    • Windows: Ctrl + Shift + f
  • Re-open a closed editor When you have multiple open files and accidentally close one or more of them, finding them, and re-opening can be time-consuming and a little frustrating. This is an undo feature exclusively for tabs:

    • Mac: Command + Shift + t
View web-scraper_scrape.js
import axios from 'axios';
import cherrio from 'cheerio';
async function getHTML(productURL) {
const { data: html } = await axios.get(productURL, {
headers: {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36'
}
})
.catch(function (error) {
@akexorcist
akexorcist / index.js
Last active Oct 21, 2020
Axios post method requesting with x-www-form-urlencoded content type
View index.js
const axios = require('axios')
const qs = require('querystring')
...
const requestBody = {
name: 'Akexorcist',
age: '28',
position: 'Android Developer',
description: 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/',
@xxxxlr
xxxxlr / React-Native-WebView-Cookies.js
Created Jul 27, 2017 — forked from kanzitelli/React-Native-WebView-Cookies.js
React Native Trick: Get Cookies of WebView without using any native modules such as react-native-cookies. Might be helpful for getting JWT while making OAuth2 👽
View React-Native-WebView-Cookies.js
// @flow
import React, { Component } from 'react';
import {
WebView,
} from 'react-native';
class LoginScreen extends Component {
state = {
cookies : {},
@wesbos
wesbos / async-await.js
Created Feb 22, 2017
Simple Async/Await Example
View async-await.js
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@patpohler
patpohler / Big List of Real Estate APIs.md
Last active Oct 23, 2020
Evolving list of Real Estate APIs by Category
View Big List of Real Estate APIs.md

Big List of Real Estate APIs

Listings / Property Data

####Rets Rabbit http://www.retsrabbit.com

Rets Rabbit removes the nightmare of importing thousands of real estate listings and photos from RETS or ListHub and gives you an easy to use import and Web API server so you can focus on building your listing search powered website or app.

@jonathansick
jonathansick / query.graphql
Last active Sep 22, 2020
GitHub GraphQL repo commit history query
View query.graphql
{
repository(name: "sickvim", owner: "jonathansick") {
ref(qualifiedName: "master") {
target {
... on Commit {
id
history(first: 5) {
pageInfo {
hasNextPage
}
@msmfsd
msmfsd / es7-async-await.js
Last active Oct 24, 2020
Javascript fetch JSON with ES7 Async Await
View es7-async-await.js
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
@tleen
tleen / marvel-api-client.js
Created Mar 12, 2016
Example call to the Marvel API from js client (w/ JQuery)
View marvel-api-client.js
// you will also have to setup the referring domains on your marvel developer portal
var PRIV_KEY = "this-should-be-a-long-hash";
var PUBLIC_KEY = "so-should-this";
function getMarvelResponse() {
// you need a new ts every request
var ts = new Date().getTime();
var hash = CryptoJS.MD5(ts + PRIV_KEY + PUBLIC_KEY).toString();
You can’t perform that action at this time.