Skip to content

Instantly share code, notes, and snippets.

Nate Adams n8jadams

Block or report user

Report or block n8jadams

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@astenmies
astenmies / graphql-go-mongodb-example.go
Last active Jun 23, 2019
Minimal example of GraphQL Golang and MongoDB playing nicely together. Edit
View graphql-go-mongodb-example.go
// Embedded in this article https://medium.com/p/c98e491015b6
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/graph-gophers/graphql-go"
@simonhamp
simonhamp / AppServiceProvider.php
Last active Sep 8, 2019
A pageable Collection implementation for Laravel
View AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@pixeline
pixeline / php_upgrade_to_71.sh
Last active May 14, 2019
Update Mac Os X's php version to php 7.1 using homebrew. Includes curl and mcrypt
View php_upgrade_to_71.sh
# 1. Install brew --> http://brew.sh/
# 2. run the following commands in your Terminal
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install --with-openssl curl
brew install --with-homebrew-curl --with-apache php71
brew install php71-mcrypt php71-imagick
# 3. Follow these instructions to make Apache and php-cli use the newer php executable and make the change persist after reboot.
brew info php71
@molivier
molivier / gist:271bba5d67de1583a8e3
Last active Sep 17, 2019
Set $GOPATH on Mac OSX : bash_profile
View gist:271bba5d67de1583a8e3
# Edit ~/.bash_profile
export GOPATH=/Users/$USER/go
export PATH=$GOPATH/bin:$PATH
# Reload profile : source ~/.bash_profile
@ziggi
ziggi / parents.js
Created Apr 13, 2015
Vanilla JS jQuery.parents() realisation
View parents.js
Element.prototype.parents = function(selector) {
var elements = [];
var elem = this;
var ishaveselector = selector !== undefined;
while ((elem = elem.parentElement) !== null) {
if (elem.nodeType !== Node.ELEMENT_NODE) {
continue;
}
@JayWood
JayWood / closetags.php
Created Jul 18, 2014
Close ALL open HTML tags in PHP string
View closetags.php
<?php
function closetags($html) {
preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result);
$openedtags = $result[1];
preg_match_all('#</([a-z]+)>#iU', $html, $result);
$closedtags = $result[1];
$len_opened = count($openedtags);
@kkirsche
kkirsche / Install Composer to use MAMP's PHP.md
Last active Sep 17, 2019
How to install Composer globally using MAMP's PHP
View Install Composer to use MAMP's PHP.md

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@jfloff
jfloff / mamp.md
Last active Aug 31, 2019
How to get MAMP to work with SSL ... Yes really.
View mamp.md

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you:

You can’t perform that action at this time.