Skip to content

Instantly share code, notes, and snippets.

View bengitiger's full-sized avatar
🐶
I may be slow to respond.

Bengi bengitiger

🐶
I may be slow to respond.
View GitHub Profile
@Lordnibbler
Lordnibbler / pull-request-template.md
Last active October 20, 2022 17:32
Sample Pull Request Template

Status

READY/IN DEVELOPMENT/HOLD

Migrations

YES | NO

Description

A few sentences describing the overall goals of the pull request's commits.

Related PRs

@marocchino
marocchino / 094607.md
Last active July 19, 2022 14:25
ES6시대의 JavaScript

ES6시대의 JavaScript

안녕하세요. 사원사업부의 마루야마@h13i32maru입니다. 최근의 Web 프론트엔드의 변화는 매우 격렬해서, 조금 눈을 땐 사이에 점점 새로운 것이 나오고 있더라구요. 그런 격렬한 변화중 하나가 ES6이라는 차세대 JavaScript의 사양입니다. 이 ES6는 현재 재정중으로 집필시점에서는 Draft Rev31이 공개되어있습니다.

JavaScript는 ECMAScript(ECMA262)라는 사양을 기반으로 구현되어있습니다. 현재 모던한 Web 브라우저는 ECMAScript 5.1th Edition을 기반으로 한 JavaScript실행 엔진을 탑재하고 있습니다. 그리고 다음 버전인 ECMAScript 6th Edition이 현재 재정중으로, 약칭으로 ES6이라는 명칭이 사용되고 있습니다.

@n5i
n5i / encoding.php
Created November 12, 2012 11:51
Encoding detection class
<?php
class Encoding {
protected static $win1252ToUtf8 = array(
128 => "\xe2\x82\xac",
130 => "\xe2\x80\x9a",
131 => "\xc6\x92",
132 => "\xe2\x80\x9e",
@cballou
cballou / laravel-global-exception-handler.php
Last active September 12, 2021 10:45
Global handling of Laravel exceptions to better support AJAX requests.
<?php namespace App\Exceptions;
use Log;
use Mail;
use Config;
use Exception;
use Illuminate\Auth\Access\UnauthorizedException;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
@kijin
kijin / ezpdo.php
Last active March 23, 2021 18:28
Easy PDO wrapper class
<?php
/**
* Easy PDO for PHP 5.x
* Version 1.2
*
* Copyright (c) 2009-2014 Kijin Sung <kijin@kijinsung.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@psychonetic
psychonetic / CustomVeeValidator
Last active April 4, 2020 07:02
Vue-Dropzone and Vee-Validate
// Custom Validator to add errors into vuex store and also handle laravel form errors.
import { mapGetters } from 'vuex';
import { CLEAR_FORM_ERRORS, ERROR } from '../vuex/types';
import Vue from 'vue';
export default {
data() {
return {
errors: [],
keepServerErrors: ['unique', 'boolean', 'exists', 'regular_chars', 'identifier', 'date'],
@pranildasika
pranildasika / gist:2964211
Created June 21, 2012 06:26
Virtual fields using getter and setter methods in sequelize
var Sequelize = require('sequelize')
var sequelize = new Sequelize('sequelize_test', 'root')
//Note that the model definition does not have "fullName"
var User = sequelize.define('User', {
email: Sequelize.STRING,
firstName: Sequelize.STRING,
lastName: Sequelize.STRING,
},
{
// Make sure to put this at the top of your AppServiceProvider: use Illuminate\Support\Facades\Validator;
Validator::extend('youtube', function ($attribute, $value, $parameters, $validator) {
preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+(?=\?)|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#", $value, $matches);
return count($matches) > 0;
}, "Sorry, this doesn't look like a valid youtube URL");
Validator::extend('youtube', function ($attribute, $value, $parameters, $validator) {
return preg_match("/(youtube.com|youtu.be)\/(watch)?(\?v=)?(\S+)?/", $value);
}, "Sorry, this doesn't look like a valid youtube URL");
@bayareawebpro
bayareawebpro / intervention-image-placeholder.php
Last active November 24, 2018 14:17
FontAwesome SVG, Custom Fonts and Shapes.
<?php
//Intervention Image Package:
//http://image.intervention.io
Route::get('generate', function(){
$text = 'image/jpg';
$width = 1600;
$height = 1000;
$centerH = $width/2;