Skip to content

Instantly share code, notes, and snippets.

View nicStuff's full-sized avatar

Nicola Baisero nicStuff

View GitHub Profile
@aeurielesn
aeurielesn / build.xml
Created August 4, 2011 05:24
ant script to get local revision number from the subversion's .svn/entries file
<?xml version="1.0" encoding="UTF-8"?>
<project name="svn" default="revision-number" basedir=".">
<target name="check-svn-entries">
<available file=".svn/entries" property="svn.entries.present"/>
</target>
<target name="revision-number" depends="check-svn-entries" if="svn.entries.present">
<loadfile srcfile=".svn/entries" property="revision">
<filterchain>
@stephenhardy
stephenhardy / git-clearHistory
Created April 26, 2013 22:14
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 18, 2024 16:07
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@whatnickcodes
whatnickcodes / base64.js
Created April 24, 2014 15:01
How to Encode and Decode Strings with Base64 in JavaScript
// Create Base64 Object
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r
@xavierlepretre
xavierlepretre / getTransactionReceiptMined.js
Last active February 5, 2023 03:26
Get the Promise of an Ethereum transaction receipt when it is finally mined
const Promise = require("bluebird");
const sequentialPromise = require("./sequentialPromise.js");
/**
* @param {!string | !Array.<!string>} txHash, a transaction hash or an array of transaction hashes.
* @param {Number} interval, in seconds.
* @returns {!Promise.<!object> | !Promise.<!Array.<!object>>} the receipt or an array of receipts.
*/
module.exports = function getTransactionReceiptMined(txHash, interval) {
const self = this;