Skip to content

Instantly share code, notes, and snippets.

git inspector

Andrew Luca iamandrewluca

git inspector
Block or report user

Report or block iamandrewluca

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
iamandrewluca /
Last active Aug 6, 2019
Grep l10n labels from project
grep -rhosP "(?<=l10n\(\')([\w\.]+)(?=\'\))" src/
  • -r recursive in nested folders and files
  • -h don't show file names
  • -o print only matches
  • -s silent errors
  • -P activate advanced perl regex
  • (?<=l10n\(\') must start with l10n(' but don't include in match
iamandrewluca / index.js
Last active Jul 26, 2019
Open DefinitelyTyped package definitions
View index.js
const link = document.createElement('a');
const packageName = window.prompt('Package name');
if (packageName) {
link.href = '' + packageName;
} else {
link.href = '';
} = '_blank';
iamandrewluca / index.js
Last active Jul 25, 2019
app.get as app.use
View index.js
const express = require("express");
const app = express();
const staticServe = express.static("public");
function appUse(root, middleware) {
// don't have to do magic
if (!root) {
console.log("no root");
return middleware;
View nested-object-flatten-keys.js
const theObject = {
nested1: {
key1: "value1",
nested2: {
key2: "value2"
key3: "value3",
key4: ["test", "test1"]
iamandrewluca / spy-typing.js
Created May 15, 2019
This script will spy the page for what you type and when will match what you find will inform
View spy-typing.js
function spy(regexp, callback) {
let state = "";
document.addEventListener("keydown", function(e) {
state += e.key;
const match = state.match(regexp);
if (match) {
state = "";
iamandrewluca / mailto-confirm.js
Last active Mar 26, 2019
Will prompt to confirm mailto links.
View mailto-confirm.js
Array.from(document.querySelectorAll('[href^="mailto:"]')).forEach(a => {
a.addEventListener('click', function(e) {
if (!confirm('Are you sure?')) {
iamandrewluca / array-operator-overload.cpp
Created Mar 20, 2019
Supraincarcarea operatorului paranteze patrate de 2 ori in C++ creind o matrice.
View array-operator-overload.cpp
Titlu: Supraincarcarea operatorului [][] in C++ creind o matrice.
Autor: Luca Andrei
Descriere: De fapt operatorul [][] nu poate fi supraincarcat,
deoarece el nu este operator )), ma contrazic pe mine ce am scris in titlu ).
De fapt aici sunt doi operatori []. Pentru a "supraincarca" [][], avem nevoie
sa cream 2 clase, si pentru fiecare in parte sa supraincarcam [].
Urmariti exemplul de mai jos pentru lamurire.
iamandrewluca / array-alloc.c
Created Mar 20, 2019
Alocarea dinamica a unui tablou bidimensional
View array-alloc.c
#include <stdio.h>
#include <conio2.h>
#include <stdlib.h>
int **a, n, m, i, j;
int main(void){
// citesti numarul de linii
printf("Dati numarul de linii >> ");
iamandrewluca / conio.c
Created Mar 20, 2019
Citeva functii din conio.h create cu ajutorul bibliotecii windows.h
View conio.c
#include <windows.h>
// ShowCursor(true) afiseaza cursorul
// ShowCursor(false) nu afiseaza cursorul
void ShowCursor(bool show)
HANDLE hConsoleOutput;
hConsoleOutput = GetStdHandle( STD_OUTPUT_HANDLE );
GetConsoleCursorInfo( hConsoleOutput, &structCursorInfo );
You can’t perform that action at this time.