Skip to content

Instantly share code, notes, and snippets.

View stefek99's full-sized avatar
🦄
Rainbows. Lasers. Unicorns.

Michal Stefanow stefek99

🦄
Rainbows. Lasers. Unicorns.
View GitHub Profile
@stefek99
stefek99 / thread-structure.json
Created October 4, 2015 22:27
How to make sense out of this data?
{
"id": "15033a9bcb309844",
"historyId": "173230",
"messages": [
{
"id": "15033a9bcb309844",
"threadId": "15033a9bcb309844",
"labelIds": [
"SENT",
"IMPORTANT"
@stefek99
stefek99 / google-API.js
Created October 2, 2015 10:09
Authentication
exports.exchangeTokens = function(code) {
var defer = q.defer();
var requestURL = "https://www.googleapis.com/oauth2/v3/token";
var post_data = {
code : code,
client_id : google_client_id,
client_secret : google_client_secret,
redirect_uri : 'postmessage',
grant_type : "authorization_code",
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<script>
window.onerror = function(e) {
@stefek99
stefek99 / issue.md
Created July 31, 2015 09:36
This is an unasked question I was about to create on StackOverflow

Possible duplicate: http://stackoverflow.com/questions/25779027/load-default-chrome-profile-with-webdriverjs-selenium

I'm trying to run Selenium automation and due to sophisticated authentication mechanisms (smart card + redirects) I'd like to use existing browser profile (rather than fresh browser instance each time).

I'm using JavaScript driver - https://code.google.com/p/selenium/wiki/WebDriverJs

var webdriver = require('selenium-webdriver');

var chromeOptions = webdriver.Capabilities.chrome();
@stefek99
stefek99 / index.html
Created June 20, 2015 07:55
AngularJS + AngularUI (Bootstrap)
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min.js'></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
@stefek99
stefek99 / index.html
Last active August 29, 2015 14:23
Ember Data Starter Kit
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ember Starter Kit</title>
</head>
<body>
<script type="text/x-handlebars">
<h2>Ember Starter Kit</h2>

Android - Phonegap - Cordova - Plugin - AdMob - Intents

(just remember to include your own jQuery / Zepto)

@stefek99
stefek99 / app.js
Last active December 2, 2015 16:32
Setting CORS (cross origin resource sharing) headers in node.js express app
var express = require('express');
var app = express();
var fs = require('fs');
var cors = require('cors');
app.configure(function() {
// has to be in that order
app.use(cors());
app.use(express.static(__dirname + '/static'));
@stefek99
stefek99 / README.md
Last active September 18, 2017 01:45
Old answer (removed from StackOverflow)

Originally it was here: http://stackoverflow.com/a/11818691/775359

Piece of working code

(I'm sure it will help)

Well... Many things have changes since then and I believe it is worth keeping things up to date :)