Skip to content

Instantly share code, notes, and snippets.

View notflip's full-sized avatar
🎯
Focusing

Miguel Stevens notflip

🎯
Focusing
  • Studio Monty
  • Ghent, Belgium
View GitHub Profile
@vxnick
vxnick / gist:380904
Created April 27, 2010 15:52
Array of country codes (ISO 3166-1 alpha-2) and corresponding names
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
@zvineyard
zvineyard / html_form
Created August 30, 2012 15:29
PHP: Upload and Rename File
<form action="" enctype="multipart/form-data" method="post">
<input id="file" name="file" type="file" />
<input id="Submit" name="submit" type="submit" value="Submit" />
</form>
@msurguy
msurguy / eloquent.md
Last active February 8, 2022 03:13
Laravel 4 Eloquent Cheat Sheet.

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@ktmud
ktmud / gulpfile.js
Last active February 28, 2022 10:39
An example gulpfile.js with bower components and live reload support
var BatchStream = require('batch-stream2')
var gulp = require('gulp')
var coffee = require('gulp-coffee')
var uglify = require('gulp-uglify')
var cssmin = require('gulp-minify-css')
var bower = require('gulp-bower-files')
var stylus = require('gulp-stylus')
var livereload = require('gulp-livereload')
var include = require('gulp-include')
var concat = require('gulp-concat')
@vnykmshr
vnykmshr / phabricator.sh
Last active February 22, 2016 20:41
Ubuntu phabricator setup
#!/bin/bash
confirm() {
echo "Press RETURN to continue, or ^C to cancel.";
read -e ignored
}
GIT='git'
LTS="Ubuntu 10.04"
@niraj-shah
niraj-shah / fb_4.0.x.php
Last active September 7, 2019 15:56
Facebook PHP SDK 4.0.0 Example
<?php
// include required files form Facebook SDK
require_once( 'Facebook/HttpClients/FacebookHttpable.php' );
require_once( 'Facebook/HttpClients/FacebookCurl.php' );
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' );
require_once( 'Facebook/Entities/AccessToken.php' );
require_once( 'Facebook/Entities/SignedRequest.php' );
import {Injectable, provide} from 'angular2/core';
import {Observable} from 'rxjs';
const GEOLOCATION_ERRORS = {
'errors.location.unsupportedBrowser': 'Browser does not support location services',
'errors.location.permissionDenied': 'You have rejected access to your location',
'errors.location.positionUnavailable': 'Unable to determine your location',
'errors.location.timeout': 'Service timeout has been reached'
};
@santoshachari
santoshachari / Laravel PHP7 LEMP AWS.md
Last active February 20, 2024 10:00
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@enjalot
enjalot / README.md
Last active January 15, 2021 09:48
Mapbox-gl -> d3 projection

This example shows how to convert from a Mapbox-gl map projection to a d3.geo Mercator projection. This allows you to take full advantage of all the d3.geo based functions and examples while also leveraging the power and ease-of-use of mapbox-gl

Much credit goes to @vicapow who developed viewport-mercator-project where he figured out the necessary calculations to make this work.

Built with blockbuilder.org

@JacobBennett
JacobBennett / ReadMe.MD
Last active September 30, 2023 09:14
Loading Laravel Sentry only for production

Loading Laravel Sentry package only for production

In the case that you don't want development errors making their way to Sentry for error tracking, you can use the code below to ensure that Sentry will only record exceptions when in production.

First, instead of loading the SentryLaravelServiceProvider in the config/app.php providers array, we will load it in our App/Providers/AppServiceProvider.php. This allows us to check the environment before loading the appropriate service providers.

Seconly, in our App/Exceptions/Handler.php we again check for the production environment before trying to capture the exception using Sentry. This second step prevents Sentry from trying to catch an exception when it isn't bound in the container.