Skip to content

Instantly share code, notes, and snippets.

Gevik Babakhani blendsdk

Block or report user

Report or block blendsdk

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
View merge-back.sh
#!/bin/bash
curent_branch=$(git rev-parse --abbrev-ref HEAD)
exists=$(git show-ref refs/heads/$1)
back_branch=$1
if [ -z "${exists}" ]; then
echo -e "\033[91mERROR: \033[0mInvalid or missing back branch ${back_branch}"
exit 1;
fi
echo -e "\033[96mINFO: \033[0m Merging \033[93m${curent_branch} \033[0monto \033[93m${back_branch}\033[0m"
@blendsdk
blendsdk / setup.sh
Created Sep 14, 2018
.NET Core project setup.sh
View setup.sh
#!/bin/bash
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DOTNET_ROOT=${SCRIPT_DIR}/.dotnet
BIN_DIR=${SCRIPT_DIR}/bin
DOTNET_INSTALL=${BIN_DIR}/dotnet-install.sh
DOTNET=${DOTNET_ROOT}/dotnet
CAKE=${BIN_DIR}/dotnet-cake
export DOTNET_CLI_TELEMETRY_OPTOUT=1
View release.sh
#!/bin/bash
# This bash script will try to create a new relase and publish an
# npm package at the same time
function confirm()
{
echo -n "$@ "
read -e answer
for response in y Y yes YES Yes Sure sure SURE OK ok Ok
View git-feature
#!/usr/bin/php
<?php
if(count($argv) !== 2) {
die("Need a new branch name\n");
}
$info = pathinfo($argv[0]);
$command = str_replace("git-","",$info["basename"]);
$new_branch = str_replace(array(' ',"\\","\"","\t","\n","\r","-"),'-',$argv[1]);
View custom.js
jQuery(document).ready(function($){
var headerHeight = $('#masthead').outerHeight();
$('#go-top, .next-page').localScroll({
offset: {
top: -headerHeight
}
});
$(window).scroll(function(){
if($(window).scrollTop() > 200){
View material-design-color-extract.js
// Extract Material Design Colors from the specs website.
// open [https://www.google.com/design/spec/style/color.html#color-color-palette] in FireBug
// Then run
console.clear();
var mdPalette = {
};
var sassPalette = [
];
var colorPalette = document.querySelector('.color-palette');
var colorGroups = colorPalette.querySelectorAll('.color-group');
View git-feature
#!/bin/bash
RED='\033[0;31m'
NC='\033[0m'
cur_branch_name=$(git symbolic-ref -q HEAD)
cur_branch_name=${cur_branch_name##refs/heads/}
cur_branch_name=${cur_branch_name:-HEAD}
cache=~/bin
reponame=$(basename $(git rev-parse --show-toplevel))
@blendsdk
blendsdk / jquery-ish.js
Created Dec 3, 2015
Something like what JQuery does
View jquery-ish.js
console.clear();
var $ = function(selector) {
var list = document.querySelectorAll(selector)
var each = function(callback) {
return function() {
for(var a = 0; a != list.length; a++) {
var obj = list[a];
callback.apply(obj,arguments);
}
return list;
@blendsdk
blendsdk / singleton.ts
Last active Aug 29, 2015
TypeScript singleon pattern
View singleton.ts
/**
* Simple singleton pattern in TypeScript
*/
module Utils {
class GreeterSingleton {
public sayHello(name:string) : void {
alert(`Hello ${name}!`);
}
@blendsdk
blendsdk / php-serve.sh
Created Jun 10, 2015
Start built-in PHP http server from next available port
View php-serve.sh
#!/bin/bash
IPADDR=127.0.0.1
STARTPORT=8000
ENDPORT=9000
found=false
for (( port = $STARTPORT ; port <= $ENDPORT ; port++ )); do
printf "Checking $port\r";
if ! nc -z -w5 $IPADDR $port
then
You can’t perform that action at this time.