Skip to content

Instantly share code, notes, and snippets.

View djGrill's full-sized avatar
🚀

dAIvd djGrill

🚀
View GitHub Profile
@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active June 17, 2024 11:44
How to reset PG Database on Heroku (for Rails app)?

It's important to note that running this reset will drop any existing data you have in the application

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

@robvolk
robvolk / es6_fetch_example.js
Last active October 17, 2019 16:46
AJAX requests in ES6 using fetch()
// ES6 Fetch docs
// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
fetch('https://some.url.com')
.then(response => {
if (response.ok) {
return Promise.resolve(response);
}
else {
return Promise.reject(new Error('Failed to load'));
@yalab
yalab / bootstrap-memo.md
Last active July 20, 2022 20:29
rails5 + webpacker + bootstrap
$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add [email protected] jquery popper.js
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644
@asukakenji
asukakenji / go-stdlib-interface-selected.md
Last active April 8, 2025 14:21
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.

@alexedwards
alexedwards / main_test.go
Last active June 15, 2024 00:55
MaxOpenConns benchmark
package main
import (
"database/sql"
"testing"
"time"
_ "github.com/lib/pq"
)
@djGrill
djGrill / commands.sh
Last active June 13, 2024 11:37
Useful Rails Commands
rails new . \
--api \
--minimal \ # https://github.com/rails/rails/blob/4a4b3998300fbebf537b770d842066b13dee5072/railties/lib/rails/generators/rails/app/app_generator.rb
--skip-asset-pipeline \
--skip-bundle \
--skip-keeps \
--skip-listen \
--skip-spring \
--skip-sprockets \
--skip-test \
@coleturner
coleturner / Schema.test.js
Last active June 7, 2018 02:19
Quick Bootstrapping of Testing for Apollo Server
import {
makeExecutableSchema,
addMockFunctionsToSchema,
mockServer
} from 'graphql-tools';
const testCaseA = {
id: 'Test case A',
query: `
query {
@tkrotoff
tkrotoff / FrontendFrameworksPopularity.md
Last active May 10, 2025 01:51
Front-end frameworks popularity (React, Vue, Angular and Svelte)
#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)