Skip to content

Instantly share code, notes, and snippets.

View raksa's full-sized avatar
🎯
Focusing

raksa raksa

🎯
Focusing
View GitHub Profile
@molcik
molcik / test.php
Last active October 6, 2018 02:53
Getty Images API SDK - PHP
<?php
require __DIR__.'/vendor/autoload.php'; // <--- Notice this line, it's missing in example file
// include __DIR__.'/build/GettyImagesApi.phar'; // <--- Uncaught DI\Definition\Exception\DefinitionException: Entry "ICurler" cannot be resolved
include __DIR__.'/src/GettyImages_Client.php';
use GettyImages\Api\GettyImages_Client;
$apiKey = "superSecretApiKey";
$apiSecret = "superSecretApiSecret";
@ibraheem4
ibraheem4 / postgres-brew.md
Last active July 18, 2024 00:18 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@raksa
raksa / vendor-prefix-mixin.scss
Last active April 15, 2022 11:42
Vendor prefix mixin for sass.
@mixin prefix-border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
border-radius: $radius;
}
// http://joshbroton.com/quick-fix-sass-mixins-for-css-keyframe-animations/
@mixin animation($animate...) {
$max: length($animate);
@tegansnyder
tegansnyder / MacOS Sierra - Custom PHP Compiled from Source with Threading and Custom ODBC Support.md
Last active December 11, 2022 21:53
MacOS Sierra - Custom PHP Compiled from Source with Threading and Custom ODBC Support

I recently got a new Macbook Pro and wanted to document how I setup my PHP environment. I like full control of how PHP is built and I usually build it from source. I do this because I often add custom extensions and modules not found in the common PHP OSX installers. If your looking for a easier method than building from source try https://php-osx.liip.ch/.

NOTE: This post assumes you are running a fresh install of MacOS Sierra 10.12.16 with System Integrity Protection disabled. If you don't know how to disable it just boot into recovery mode and open a terminal and type csrutil disable, or google search it :) This post also assumes you are using Zsh instead of Bash shell. If you are using Bash you can replace anytime you see ~/.zshrc with ~/.bashrc.

First lets get some of the prerequisites. Start by grabbing the command line tools neccessary:

xcode-select --install
@merlinvn
merlinvn / gulp.js
Created September 18, 2016 08:46
Gulp for C++
var gulp = require('gulp');
var exec = require('child_process').exec;
var cmakeCommand = "mkdir -p build; cd build; cmake ..;";
var cleanCommand = "rm -rf build";
var testCommand = "cd build; ctest -V";
//"cmake --build ."

top (the UNIX process inspector) cheat sheet

This is a list of the most helpful keyboard commands I use within top.

The basics

h shows help on interactive commands. Also see the top manual page

q to quit the program.

@drewjoh
drewjoh / Cors.php
Created June 13, 2016 22:47
Laravel CORS Middleware
<?php // /app/Http/Middleware/Cors.php
namespace App\Http\Middleware;
use Closure;
class Cors {
public function handle($request, Closure $next)
{
return $next($request)
@joyrexus
joyrexus / http-errors.js
Created June 6, 2016 23:30 — forked from moleike/http-errors.js
HTTP Error classes in Node.js
'use strict';
const statusCodes = require('http').STATUS_CODES;
function createError(code, name) {
return function(message) {
Error.captureStackTrace(this, this.constructor);
this.name = name;
this.message = message;
this.statusCode = code;
}
@mrister
mrister / forever-config.json
Last active November 16, 2023 16:24
Forever example with config file
{
// Sample configuration for app in /home/myuser/app dir
"uid": "app",
"max": 5, // restart the app successively maximum of 5 times
"spinSleepTime": 1000, // time to wait until a next restart is attempted (in ms)
"append": true, // append the logs, do not overwrite
"watch": true, // watch for changes and restart if they occur
"script": "server.js", // main startup script (almost like issuing node server.js)
"sourceDir": "/home/myuser/app", // the dir where your entire app code resides (dir structure is recursively traversed)
"args": ["--myAPIKey", "xBlzdn84fa"] // pass any arguments to your app
@gbuckingham89
gbuckingham89 / AuthServiceProvider.php
Last active August 22, 2022 12:01
Blog: Laravel Authentication Customer User Provider Demo
<?php
namespace App\Authentication;
use Auth;
use App\Authentication\UserProvider;
use Illuminate\Support\ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{