Skip to content

Instantly share code, notes, and snippets.

View iamandrewluca's full-sized avatar
🚨
Git Inspector

Andrei Luca iamandrewluca

🚨
Git Inspector
View GitHub Profile
@iamandrewluca
iamandrewluca / typehead.js
Last active December 21, 2017 00:36
typehead config
var ourResponse = {
"tasks": [
{ "title": "Lorem ipsum", "link": "http://google.com" },
{ "title": "Lorem ipsum", "link": "http://google.com" },
{ "title": "Lorem ipsum", "link": "http://google.com" },
{ "title": "Lorem ipsum", "link": "http://google.com" },
{ "title": "Lorem ipsum", "link": "http://google.com" },
],
"tips": [
@iamandrewluca
iamandrewluca / faker.js
Last active May 22, 2017 09:35
Add some lorem text to active input or textarea
(function() {
var fakerCDN = 'https://cdnjs.cloudflare.com/ajax/libs/Faker/3.1.0/faker.min.js';
var fakerId = 'injected-faker';
var script;
var isFakerInjected = document.getElementById(fakerId);
if (!isFakerInjected) {
script = document.createElement('script');
script.id = fakerId;
@iamandrewluca
iamandrewluca / git-emails.sh
Created June 1, 2017 16:02
List all emails participated at a git repository with commits count
git log --format='%ae' | sort | uniq -c | sort -nr
@iamandrewluca
iamandrewluca / ImageGalleryViewHelper.php
Last active June 12, 2018 12:36
TYPO3 Gallery ViewHelper Shortcode
<?php
namespace Vendor\ExtensionName\ViewHelpers;
use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException;
use TYPO3\CMS\Core\Resource\FileCollectionRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
*
* @author: https://github.com/filamentgroup/select-css
*
*/
/* Container used for styling the custom select, the buttom class below adds the bg gradient, corners, etc. */
.custom-select {
position: relative;
display: block;
javascript: $('[id]').each(function() {
var id = $('[id="' + this.id + '"]');
if (id.length > 1 && id[0] == this) {
console.log('Duplicate id ' + this.id);
id.css('outline', '5px solid red');
alert('duplicate found');
}
});
@iamandrewluca
iamandrewluca / GameWon.png
Last active August 23, 2017 19:14
2nd year at Univeristy. Minesweeper in terminal. Made on windows, might work on *nix
GameWon.png
@iamandrewluca
iamandrewluca / rebase-howto-A-B.md
Last active December 20, 2017 14:17
Do you even rebase?

Moving range of commits start-hash(included) -> end-hash(included) from branch A to branch B
First ensure that you pushed all changes from A and B to their origins

^ indicates to start exactly from start-hash

git checkout A
git rebase --onto B start-hash^ end-hash

If end-hash is excluded from rebase command, it will take all commits from start-hash to HEAD

@iamandrewluca
iamandrewluca / egghead-video.js
Last active January 31, 2018 22:31
egghead video playbackRate speed
javascript:document.addEventListener('keydown', (e) => {
if (e.metaKey && e.ctrlKey && e.altKey) {
const video = document.querySelector('.bitmovinplayer-container video');
if (e.code === "BracketLeft") {
video.playbackRate -= 0.25;
return;
}
if (e.code === "BracketRight") {
video.playbackRate += 0.25;
def walk(f):
. as $in
| if type == "object" then
reduce keys_unsorted[] as $key
( {}; . + { ($key): ($in[$key] | walk(f)) } ) | f
elif type == "array" then map( walk(f) ) | f
else f
end;
def keys_sort_by(f):