Skip to content

Instantly share code, notes, and snippets.

View ppbntl19's full-sized avatar
🎯
Focusing

Pooran Prakash ppbntl19

🎯
Focusing
View GitHub Profile
@borismus
borismus / gist:1032746
Created June 18, 2011 02:46
Convert a base64 string into a binary Uint8 Array
var BASE64_MARKER = ';base64,';
function convertDataURIToBinary(dataURI) {
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
var base64 = dataURI.substring(base64Index);
var raw = window.atob(base64);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));
for(i = 0; i < rawLength; i++) {
@mojodna
mojodna / Procfile
Created September 29, 2011 20:22 — forked from RandomEtc/Procfile
Getting Kue working on Heroku
web: node app.js
worker: node consumer.js
@scttnlsn
scttnlsn / README.md
Created July 30, 2012 22:16
Pub/sub with MongoDB and Node.js

Pub/sub with MongoDB and Node.js

Setup:

$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
@bennadel
bennadel / demo.htm
Created August 17, 2012 14:43
Using Underscore.js Templates To Render HTML Partials
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Looking At Underscore.js Templates</title>
</head>
<body>
<h1>
Looking At Underscore.js Templates
@julionc
julionc / 00.howto_install_phantomjs.md
Last active November 18, 2024 17:45
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@coolaj86
coolaj86 / 00-test-phantom.js
Created December 31, 2013 01:05
testing phantom with indexeddb
'use strict';
var phantom = require('node-phantom-simple')
;
phantom.create(function (err, ph) {
console.log('created phantom instance');
ph.createPage(function(err, page) {
console.log('created page instance');
@yoavniran
yoavniran / simple-nodejs-iv-encrypt-decrypt.js
Last active January 20, 2022 08:16
nodejs crypto - simple encrypt & decrypt using IV (Initialization Vector)
"use strict";
var crypto = require("crypto");
var EncryptionHelper = (function () {
function getKeyAndIV(key, callback) {
crypto.pseudoRandomBytes(16, function (err, ivBuffer) {
var keyBuffer = (key instanceof Buffer) ? key : new Buffer(key) ;
@petehouston
petehouston / markup
Created October 17, 2014 07:20
[Bootstrap] Text overlay center inside the image
<div class="row" id="box-search">
<div class="thumbnail text-center">
<img src="img/cafe.jpg" alt="" class="img-responsive">
<div class="caption">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab, quisquam?</p>
</div>
</div>
</div>
@hubertlepicki
hubertlepicki / setup.sh
Created May 12, 2015 06:32
PhantomJS 2.0.1 on codeship
# I am pasting that into setup steps
# binary provided by the amazing Codeship.io support
PHANTOMJS_URL="https://s3.amazonaws.com/codeship.io/checkbot/binaries/phantomjs_2.0.1"
set -e
rm -rf ~/.phantomjs
wget --continue "${PHANTOMJS_URL}" -O "${HOME}/cache/phantomjs"
ln -s "${HOME}/cache/phantomjs" "${HOME}/bin/"
chmod +x "${HOME}/bin/phantomjs"
@zynick
zynick / download-file.js
Created January 6, 2016 12:17
download file ('save as') using javascript xhr
// http://stackoverflow.com/a/23797348/1150427
xhr.open('POST', url, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
if (this.status === 200) {
var filename = "";
var disposition = xhr.getResponseHeader('Content-Disposition');
if (disposition && disposition.indexOf('attachment') !== -1) {
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;