Skip to content

Instantly share code, notes, and snippets.

View anthonygore's full-sized avatar

Anthony Gore anthonygore

View GitHub Profile
@jhoff
jhoff / Enums.php
Last active November 18, 2023 20:47
Laravel Model Enumeration Trait
<?php
namespace App\Traits;
use Illuminate\Support\Str;
use App\Exceptions\InvalidEnumException;
trait Enums
{
/**
@anthonygore
anthonygore / slack.js
Last active August 12, 2017 04:05
Send users a welcome message (IM) from the slackbot when they join your Slack team. Uses https://github.com/smallwins/slack so look at that first. Load this somewhere in a running Node JS app.
var slack = require('slack');
var bot = slack.rtm.client();
var token = "your_slack_token";
bot.team_join(function(obj) {
console.log("Team join triggered");
slack.chat.postMessage(
{
token: token,
channel: obj.user.id,
@timstermatic
timstermatic / gist:6163577
Last active July 31, 2016 12:46
Async unique validation with expressjs and mongoose
var mongoose = require('mongoose')
,Schema = mongoose.Schema
,ObjectId = Schema.ObjectId;
var userSchema = new Schema({
email: String,
password: String,
@mburst
mburst / jquery_autocomplete.html
Created January 19, 2013 20:51
jQuery Autocomplete
<!DOCTYPE html>
<html>
<head>
<title>jQuery Autocomplete</title>
<style>
#res {
margin: 0px;
padding-left: 0px;
width: 150px;
}