Skip to content

Instantly share code, notes, and snippets.

View hprobotic's full-sized avatar
:dependabot:
On Break

John Pham hprobotic

:dependabot:
On Break
View GitHub Profile
/* TEST
curl -X POST \
https://wt-9bb02c61fe43f0ab0454b4856217d79d-0.run.webtask.io/cs-stripe \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: a8fd0d9c-8260-0a55-aa3c-a2bd95abc8cd' \
-d '{
"token": "tok_1BX47KD0WWJYOVXXb8zMrcom",
"amount": 789,
"description": "test donate"

Heroku Rails backup and restore

heroku login
heroku pg:backups:capture --app app-name
heroku pg:backups:download
pg_restore --host localhost --port 5432 --username "USER-NAME" --dbname "DB-NAME" --no-password  --verbose "latest.dump"
import React from 'react'
import PropTypes from 'prop-types'
function uniq (arr) {
let out = []
for (let i = 0; i < arr.length; i++) {
if (out.indexOf(arr[i]) === -1) {
out.push(arr[i])
}
@hprobotic
hprobotic / psql.md
Created January 10, 2018 04:01
Fix Postgres `connections on Unix domain socket "/tmp/.s.PGSQL.5432"?`

run rm /usr/local/var/postgres/postmaster.pid

@hprobotic
hprobotic / cra.md
Created March 14, 2018 08:20
Medium post
npx create-react-app my-app
cd my-app
npm start
@hprobotic
hprobotic / .eslintrc
Created March 29, 2018 12:01
hapijs eslintrc
{
"extends": "eslint-config-airbnb",
"parser": "babel-eslint",
"rules": {
"no-console": [1],
"max-len": [1, 120, 2, { "ignoreComments": true }],
"no-else-return": [0],
"import/prefer-default-export": [0],
"arrow-body-style": [0],
"class-methods-use-this": [0]
#EXTM3U
#EXTINF:-1,VTV1
http://113.189.21.251:4022/rtp/232.84.1.27:8136
#EXTINF:-1,VTV1 HD
http://113.189.21.251:4022/rtp/232.84.1.117:10254
#EXTINF:-1,VTV2
http://113.189.21.251:4022/rtp/232.84.1.39:8208
#EXTINF:-1,VTV3
http://113.189.21.251:4022/rtp/232.84.1.28:8142
#EXTINF:-1,VTV3 HD
var x = Math.floor(Math.random() * 9) + 1;
var turns = 0;
var hint = 'Guess my number, 1-10!';
while (turns < 10) {
var guess = prompt(hint);
if (!guess) break;
guess = Number(guess);
if (guess == x) {
alert("Congratulations, you are a mind reader!");
Givens a data.json file with structure bellow:
// data.json
[
{
"name": "Electronics",
"items": ["Phone", "Keyboards"]
},
{
"name": "Keyboards",
@hprobotic
hprobotic / doc.md
Created November 26, 2018 08:50
Bug fix with flask, mysql and tox
  • Fix mysqlclient:
  • Check brew info openssl