Skip to content

Instantly share code, notes, and snippets.

View mask_email
sed -E "s/([\!#-'*+\/-9?A-Z^-~-]+(\.[\!#-'*+\/-9=?A-Z^-~-]+)*|\"([]\!#-[^-~ \t]|(\\[\t -~]))+\")@([\!#-'*+\/-9=?A-Z^-~-]+(\.[\!#-'*+\/-9=?A-Z^-~-]+)*|\[[\t -Z^-~]*])/masked-email@kookoo.com/g" expensive-ops.20170904222416Z > expensive-ops.20170904222416Z_masked
@randavidovitz
randavidovitz / SaveBinaryAsciiFile.js
Last active Aug 29, 2015
The correct way to save a file using request module
View SaveBinaryAsciiFile.js
SaveThePDF(url, filename) {
const writeFile = denodeify(fs.writeFile);
const requestPromised = denodeify(request.defaults({
'gzip': true,
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*\/*;q=0.8',
}
}), function(err, httpResponse, body) {
// Convert 3 paramters to 2
@randavidovitz
randavidovitz / gist:11539f3cfb2b482776c4
Created Dec 2, 2014
sample service that wrap the google client API
View gist:11539f3cfb2b482776c4
<script src="https://apis.google.com/js/client.js?onload=init"></script>
var init = function() {
window.initGapi();
}
angular.module('MyModule', [])
.service('gapiService', function($q,$rootScope, $window) {
var service = $rootScope.$new(true);
var youtubeAPIready = $q.defer();