Skip to content

Instantly share code, notes, and snippets.

💭
oɹǝɥɹǝdns

Erik Landvall superhero

💭
oɹǝɥɹǝdns
Block or report user

Report or block superhero

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
@superhero
superhero / git.md
Last active Aug 8, 2017
Git commands...
View git.md

remove last commit from git and github

git push -f origin HEAD^:master

@superhero
superhero / git-commit-push.sh
Created Dec 22, 2016
run in root of multiple projects to commit and push them all at once
View git-commit-push.sh
#!/bin/bash
# note that all commits will have the same commit message
if [ $# -eq 1 ]; then
MSG=$1
else
read -p "commit message: " MSG
fi
for d in */ ; do
@superhero
superhero / npm-publish.sh
Created Dec 22, 2016
run in root folder of multiple npm packages to publish them all with 1 command
View npm-publish.sh
#!/bin/bash
docker run \
-it \
--rm \
--volume /etc/localtime:/etc/localtime:ro \
--volume `pwd`/.npmrc:/root/.npmrc \ # notice the login credentials that needs to be mounted
--volume `pwd`:/app \
--workdir /app \
node /bin/bash -c "
@superhero
superhero / math.random.seed.js
Created Nov 25, 2016
A seeded random generator
View math.random.seed.js
(seed) =>
{
const n = Math.sin(seed);
return n - Math.floor(n);
};
View .bashrc
# settig default permissions, r/rw to your user and your default group
umask 0002
# return if not running interactively
[ -z "$PS1" ] && return
# don't put duplicate lines or lines starting with space in the history
HISTCONTROL=ignoreboth:erasedups
# ignores placing the exit command in history
@superhero
superhero / auto-expand-textarea.js
Last active Mar 2, 2016
Expands the textarea depending on content
View auto-expand-textarea.js
(function($)
{
$(document).on('input', 'textarea', function()
{
var $this = $(this);
var padTop = parseInt($this.css('padding-top'), 10);
var padBot = parseInt($this.css('padding-bottom'), 10);
$this.height(0);
var scroll = $this.prop('scrollHeight');
$this.height(scroll - padTop - padBot);
@superhero
superhero / action-by-bit.php
Last active Jan 29, 2016
Do an action by bit
View action-by-bit.php
<?php
function actionByBit($actions, $dec, $bits)
{
for($i = 0, $count = count($actions); $bits > 0; $i++)
if($dec & 1 << --$bits && $i < $count)
$actions[$i]();
}
$hex = '70 0C 00 00';
@superhero
superhero / docker.phanomjs
Created Sep 18, 2015
PhantomJS docker file
View docker.phanomjs
FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
RUN ln -snf /usr/share/zoneinfo/Europe/Madrid /etc/localtime && echo "Europe/Madrid" > /etc/timezone
RUN apt-get -y update && apt-get -y install \
build-essential g++ flex bison gperf ruby perl libsqlite3-dev libfontconfig1-dev libicu-dev \
libfreetype6 libssl-dev libpng-dev libjpeg-dev python libx11-dev libxext-dev git
@superhero
superhero / docker.nodejs
Created Sep 18, 2015
NodeJS docker file
View docker.nodejs
FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
RUN ln -snf /usr/share/zoneinfo/Europe/Madrid /etc/localtime && echo "Europe/Madrid" > /etc/timezone
RUN apt-get -y update && apt-get -y install \
build-essential git python
RUN git clone git://github.com/nodejs/node.git /tmp/nodejs \
View shift.log.js
Shift.Log = function()
{
this.router =
{
'error.*': 'error'
};
this.view =
{
error: function(e)
You can’t perform that action at this time.