Skip to content

Instantly share code, notes, and snippets.

@panayotoff
panayotoff / firebaseUtils.js
Created January 13, 2017 13:47
ES6 firebase object to array
/*
* Converts firebase object to Array;
* Each object from the array will contain 'key' property,
* corresponding to the firebase key
* */
const toArray = function (firebaseObj) {
return Object.keys(firebaseObj).map((key)=> {
return Object.assign(firebaseObj[key], {key});
@joshuadegier
joshuadegier / create-backups.sh
Created January 20, 2017 11:25
Create back-ups for homestead/vagrant databases
#!/bin/bash
NOW=$(date +%Y%m%d%H%M)
USER="MYSQL_USERNAME"
PASSWORD="MYSQL_PASSWORD"
FOLDER="/home/vagrant/Projects/_dbdumps/"
cd $FOLDER
mkdir -p $NOW
https://streamacon.com/video/laracon-us/taylor-otwell-laravel-53-overview
https://streamacon.com/video/laracon-us/adam-wathan-test-driven-laravel
https://streamacon.com/video/laracon-us/chris-fidao-servers-for-hackers.
https://streamacon.com/video/laracon-us/evan-you-vuejs-workshop
https://streamacon.com/video/laracon-us/evan-you-vue-router-and-vuex
https://streamacon.com/video/laracon-us/jack-mcdade-wizards-lawnmowers-and-hovercrafts
https://streamacon.com/video/laracon-us/sentry-product-demo
https://streamacon.com/video/laracon-us/ben-ramsey-long-live-http2
https://streamacon.com/video/laracon-us/zeev-suraski-php-7
https://streamacon.com/video/laracon-us/amanda-folson-apis-with-lumen
@jesseruder
jesseruder / README
Last active April 3, 2018 17:23
Download Exponent starter projects/app builds manually
Starter apps:
Download http://expo.io/--/api/v2/versions/download-template/tabs or http://expo.io/--/api/v2/versions/download-template/blank
Extract and open in XDE
iOS Simulator build:
Download http://expo.io/--/api/v2/versions/download-ios-simulator-build
Extract to .app
Open simulator
`xcrun simctl install booted [PATH TO .app]`
# Create the project directory
# This will hold both the Bedrock and Trellis installs
mkdir $1
cd $1 && git init && cd ..
# Install Roots Bedrock
echo -e "\033[33;36m Installing Bedrock via Composer into $1/site ...";
composer create-project roots/bedrock $1/site
@sfcgeorge
sfcgeorge / packed-pixels-switchresx.md
Created December 9, 2015 16:13
Packed Pixels HiDPI Retina using SwitchResX

On OS X the Packed Pixels display won't automatically show up as "Retina" or "HiDPI" resolution, instead the OS will use the full resolution of the display making everything tiny. This can be changed using the 3rd party app (non-free) SwitchResX.

First, download SwitchResX.

You can play with the resolutions for the Packed Pixels which is probably listed as Color LCD (2). However not all of the HiDPI resolutions work due to an OS X bug. If you are happy with any of the ones that do work then stop here, else continue.

If you're on El Capitan or later you need to disable System Integrity Protection (temporarily) to add a custom resolution for Packed Pixels. Follow the instructions from SwitchResX creator.

Now add a Custom Resolution that is "scaled". It must be 2 pixels bigger or smaller than the native resolution in one direction (this is the OS X quirk). I found bigger makes it slightly blurry so go w

@jjhiew
jjhiew / default.nginx.conf
Last active November 4, 2020 22:18
Nginx configuration to setup SSL Termination and Reverse Proxy for Sendgrid Link Tracking
# Should go into `/etc/nginx/sites-available` as file named `default`
# Redirect HTTP to HTTPS
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443;
@rtrouton
rtrouton / gist:2ca6f001b3cecb5037825c7f9d2e422e
Created April 28, 2017 16:13
Xcode iOS simulator download URLs (as of Xcode 8.3.1)
iOS 10.2 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_2-10.2.1.1484185528.dmg
iOS 10.1 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_1-10.1.1.1476902849.dmg
iOS 10.0 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_0-10.0.1.1474488730.dmg
iOS 9.3 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg
iOS 9.2 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_2-9.2.1.1451951473.dmg
iOS 9.1 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_1-9.1.1.1446593668.dmg
iOS 9.0 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_0-9.0.1.1443554484.dmg
iOS 8.4 Simulator: https://devimages.a
@zaiddabaeen
zaiddabaeen / exportMySQLUsersPDO.php
Created February 23, 2016 11:47
Exports MySQL Users and Privileges using PDO
* Feel free to improve it.
* Original by Janich: https://gist.github.com/janich/6121771
*
* @requires PHP 5.3+
* @package ExportMySQLUsers
* @author Zaid Daba'een
* @license http://www.dbad-license.org/ DBAD license
*/
// Set up database root credentials
$host = 'localhost';
@fhferreira
fhferreira / haversine.php
Last active January 19, 2021 14:44
Haversine Method for model Laravel.
<?php
/*
* find the n closest locations
* @param Model $query eloquent model
* @param float $lat latitude of the point of interest
* @param float $lng longitude of the point of interest
* @param float $max_distance distance in miles or km
* @param string $units miles or kilometers
* @param Array $fiels to return
* @return array