Skip to content

Instantly share code, notes, and snippets.

View alexalexandrescu's full-sized avatar

Alex Alexandrescu alexalexandrescu

View GitHub Profile
@alexalexandrescu
alexalexandrescu / env-vars.js
Created January 17, 2019 13:41
SImple nodejs script that uses .env to generate environment.ts for Angular projects made to work on a lot of environments
#! /usr/bin/env node
const dotenvParseVariables = require('dotenv-parse-variables');
const fs = require('fs');
const chalk = require('chalk');
const envVars = require('dotenv-safe').config({
allowEmptyValues: true
});
const parsedVars = dotenvParseVariables(envVars.parsed);
@alexalexandrescu
alexalexandrescu / class.js
Created February 22, 2017 17:01
InstaLikesClass
class InstaAllLikes {
constructor() {
this.heartClass = '.coreSpriteHeartOpen';
this.nextButton = '._de018.coreSpriteRightPaginationArrow';
this.minInterval = 5;
this.maxInterval = 20;
this.likeCount = 0;
this.timeout;
const popUp = document.querySelector('._n3cp9._d20no');
@alexalexandrescu
alexalexandrescu / is_bot.php
Created November 18, 2013 12:28
Function that checks if visitor is a bot to allow indexing by search engines and social media when you have an age gate or something similar
function is_bot() {
$spiders = array( "alexa", "froogle", "abot", "dbot", "ebot", "hbot", "kbot", "lbot", "mbot", "nbot", "obot", "pbot", "rbot", "sbot", "tbot", "vbot", "ybot", "zbot", "bot.", "bot/", "_bot", ".bot", "/bot", "-bot", ":bot", "(bot", "crawl", "slurp", "spider", "seek", "accoona", "acoon", "adressendeutschland", "ah-ha.com", "ahoy", "altavista", "ananzi", "anthill", "appie", "arachnophilia", "arale", "araneo", "aranha", "architext", "aretha", "arks", "asterias", "atlocal", "atn", "atomz", "augurfind", "backrub", "bannana_bot", "baypup", "bdfetch", "big brother", "biglotron", "bjaaland", "blackwidow", "blaiz", "blog", "blo.", "bloodhound", "boitho", "booch", "bradley", "butterfly", "calif", "cassandra", "ccubee", "cfetch", "charlotte", "churl", "cienciaficcion", "cmc", "collective", "comagent", "combine", "computingsite", "csci", "curl", "cusco", "daumoa", "deepindex", "delorie", "depspid", "deweb", "die blinde kuh", "digger", "ditto", "dmoz", "docomo", "download express", "dtaagent", "dwcp",
@alexalexandrescu
alexalexandrescu / gist:5480580
Last active February 12, 2016 15:11
For responsive pages, when you embed a Youtube video it resizes with the containersource: http://css-tricks.com/examples/FluidWidthYouTube/
//jQuery is required
$(function() {
// Find all YouTube videos
var $allVideos = $("iframe[src^='http://www.youtube.com']"),
// The element that is fluid width
$fluidEl = $("body");
// Figure out and save aspect ratio for each video
$allVideos.each(function() {
$(this)