Skip to content

Instantly share code, notes, and snippets.

View dustinsmith1024's full-sized avatar
🏀
⛹️

Dustin Smith dustinsmith1024

🏀
⛹️
View GitHub Profile
@dustinsmith1024
dustinsmith1024 / postgres_queries_and_commands.sql
Last active March 28, 2018 14:58 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
https://www.postgresql.org/docs/9.4/static/monitoring-stats.html
https://www.postgresql.org/docs/9.4/static/functions-admin.html
-- show blocking pids in a nice tree
-- query as blocked_query
-- 9.6++
select pid, usename,
age(query_start, clock_timestamp()),
pg_blocking_pids(pid) as blocked_by,
query
@aheuermann
aheuermann / error_api.js
Last active March 30, 2016 23:55
Not Found Error vs Return Null w/ handlers
var facade = require('facade'),
handlers = require('handlers');
app.use("/verification/:verificationId", funciton (req, res) {
facade.getUserForVerificationId(req.params.verificationId)
.then(handlers.successHandler, handlers.errorHandler);
});
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@prasadsilva
prasadsilva / fresh-chrome-with-custom-tz.sh
Last active June 4, 2023 12:54 — forked from stuartsierra/fresh-chrome.sh
Launch new instances of Google Chrome on OS X with isolated cache, cookies, user config and custom Timezone
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active February 24, 2024 04:41
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@jakebathman
jakebathman / botPost.php
Last active July 12, 2020 00:10
GroupMe bot post function including @mentions
<?php
/**
* Post a message from a bot to a group
*
* $groupId (string) GroupId of the group to post the message
* $strMessage (string) Text of the message to post (limit of 1000 characters)
* $strBotId (string) ID of the bot which will post the message
* $mentionUsers (array) [optional] array of userIds to mention (uses attachment)
* Example array of userIds:
@mlynch
mlynch / autofocus.js
Last active August 24, 2022 15:03
AngularJS Autofocus directive
/**
* the HTML5 autofocus property can be finicky when it comes to dynamically loaded
* templates and such with AngularJS. Use this simple directive to
* tame this beast once and for all.
*
* Usage:
* <input type="text" autofocus>
*
* License: MIT
*/
@DavidVaini
DavidVaini / round.go
Created April 9, 2014 19:58
Arggh Golang does not include a round function in the standard math package. So I wrote a quick one.
package main
import (
"log"
"math"
)
func Round(val float64, roundOn float64, places int ) (newVal float64) {
var round float64
pow := math.Pow(10, float64(places))
@demisx
demisx / angularjs-providers-explained.md
Last active March 17, 2024 11:09
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@karlseguin
karlseguin / now.go
Created June 9, 2013 07:28
Testable time.Now in GoLang
package t
import (
"time"
)
type NowFunc func() time.Time
var Now = func() time.Time { return time.Now() }
func NowForce(unix int) {