Skip to content

Instantly share code, notes, and snippets.

View aramalipoor's full-sized avatar
🎯
Focusing

aram.eth aramalipoor

🎯
Focusing
View GitHub Profile
@aramalipoor
aramalipoor / README.md
Last active November 25, 2017 17:12
Re-commit snippet to commit your last commit again with same message to your remote, without adding a new commit to history

Install

sudo curl -L -o /usr/local/bin/recommit https://gist.githubusercontent.com/aramalipoor/fa0a501d985b095b4d8ec453e1ba8e56/raw/032275f887799c139a6b06e148b1146c914313b9/recommit.sh
sudo chmod +x /usr/local/bin/recommit

Disclaimer

Although this snippet checks last commit's ID on your remote branch before tying to force commit, use it at your own risk.

@aramalipoor
aramalipoor / counter.js
Created November 4, 2015 08:43
AngularJS 1.x $watch counter
(function () {
var root = $(document.getElementsByTagName('body'));
var watchers = [];
var f = function (element) {
if (element.data().hasOwnProperty('$scope')) {
angular.forEach(element.data().$scope.$$watchers, function (watcher) {
watchers.push(watcher);
});
}
@aramalipoor
aramalipoor / score.php
Last active September 5, 2015 13:42
IAUN Score Match
<?php
session_cache_expire(0);
session_set_cookie_params(1000000000);
session_start();
$start_time = time();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@aramalipoor
aramalipoor / docker_get_env.sh
Created August 17, 2015 08:22
Bash helper function to get a specific environment variable from a Docker container
#!/bin/bash
# Retrieves an enviroment variable from a docker container
docker_get_env()
{
env_json=$(docker inspect --format '{{ json .Config.Env }}' ${1})
length=$(echo ${env_json} | jq '. | length')
for (( i=0; i<${length}; i++ ))
do
@aramalipoor
aramalipoor / ContainerInvalidator.php
Last active August 29, 2015 14:22
Symfony2 Container Cache Invalidator
<?php
namespace Sylius\Bundle\ThemeBundle\DependencyInjection;
use Sylius\Bundle\ThemeBundle\EventSubscriber\ContainerInvalidatorEventSubscriber;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
class ContainerInvalidator
@aramalipoor
aramalipoor / vagrant-ansible-virtualbox.sh
Created January 25, 2015 07:53
Install Virtualbox + Vagrant + Ansible + nfs
# You should enable Virtualization flag in your BIOS.
sudo apt-get install virtualbox vagrant ansible nfs-kernel-server