Skip to content

Instantly share code, notes, and snippets.

View 3ffusi0on's full-sized avatar
🎯
Focusing

SIMON Pierre-Alain 3ffusi0on

🎯
Focusing
  • France
View GitHub Profile
# SETUP #
DOMAIN=example.com
PROJECT_REPO="git@github.com:example.com/app.git"
AMOUNT_KEEP_RELEASES=5
RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S)
RELEASES_DIRECTORY=~/$DOMAIN/releases
DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME
# stop script on error signal (-e) and undefined variables (-u)
@arodbits
arodbits / binder.php
Last active January 20, 2020 09:55
Combine binding values into a raw SQL query in Laravel. Debugging in Laravel.
<?php
//example:
$query = Foo::where('id', '=', 1)->where('name', '=', 'bar');
//would produce the following raw query:
//select * from foo where id = ? and name = ?;
dd(vsprintf(str_replace('?', '%s', $query->toSql()), collect($query->getBindings())->map(function($binding){
return is_numeric($binding) ? $binding : "'{$binding}'";
@jupdike
jupdike / IntersectTwoCircles.js
Last active August 29, 2024 09:59
Find the intersections (two points) of two circles, if they intersect at all
// based on the math here:
// http://math.stackexchange.com/a/1367732
// x1,y1 is the center of the first circle, with radius r1
// x2,y2 is the center of the second ricle, with radius r2
function intersectTwoCircles(x1,y1,r1, x2,y2,r2) {
var centerdx = x1 - x2;
var centerdy = y1 - y2;
var R = Math.sqrt(centerdx * centerdx + centerdy * centerdy);
if (!(Math.abs(r1 - r2) <= R && R <= r1 + r2)) { // no intersection
@odan
odan / xampp_php7_xdebug.md
Last active August 28, 2024 13:49
Installing Xdebug for XAMPP
@tdd
tdd / git-bash-prompt.bash
Created July 16, 2015 09:54
Bash prompt configuration for Git’s built-in prompt features
# STEP 1: ENSURE COMPLETION AND PROMPT FUNCTION ARE LOADED
# ========================================================
# OPTION 1: If on OSX using Homebrew:
#
# source $(brew --prefix)/etc/bash_completion.d/git-prompt.sh
# source $(brew --prefix)/etc/bash_completion.d/git-completion.bash
# OPTION 2: If on OSX using built-in Git (also works on ZSH):
#
@willurd
willurd / web-servers.md
Last active September 24, 2024 12:33
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@bowmanb
bowmanb / SavedTabsFragment.java
Last active December 6, 2020 23:52
A basic Android ExpandableListFragment (SavedTabsFragment) example.
package com.advinture.ukuleletabs.fragments;
import android.app.ExpandableListActivity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
@tdd
tdd / gitconfig.ini
Last active September 23, 2024 10:41
Nice, useful global Git configuration
# Put this in your ~/.gitconfig or ~/.config/git/config
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName>
[user]
name = Your Full Name
email = your@email.tld
[color]
# Enable colors in color-supporting terminals
ui = auto
[alias]
# List available aliases