Skip to content

Instantly share code, notes, and snippets.

@moff
moff / bashrc-git-branch-coloring
Created November 22, 2017 23:06
Git branch in terminal (.bashrc
# Append current git branch in prompt
parse_git_branch() {
if ! git rev-parse --git-dir > /dev/null 2>&1; then
return 0
fi
<?php
/*
1. Create a function that combines the two arrays.
Example:
[a, b, c], [1, 2, 3] => [a, 1, b, 2, c, 3]
*/
function combiner(array $a = [], array $b = []) {
$a_len = count($a);
$b_len = count($b);
SELECT u.login, GROUP_CONCAT(DISTINCT p.nm ORDER BY p.nm ASC) AS projects FROM users AS u
LEFT JOIN user_project_rel AS upr ON u.id = upr.user_id
LEFT JOIN projects AS p ON p.id = upr.project_id
GROUP BY u.login;
<?php
$arr = [
"hello world world",
"hello world world world",
"hello world world world world",
"hello hello world",
"hello hello hello hello world"
];
foreach ($arr as $str) {
<?php
$start = 2;
$end = 200;
$index = 1;
$sum = 0;
for($i = $start; $i <= $end; $i++)
{
for($j = 2; $j < $i; $j++)
{
class window.Gallery
speed: 200
move_speed: 400
preload: true
current_page: 0
reversed: false
constructor: (element) ->
@element = $(element)