Skip to content

Instantly share code, notes, and snippets.

View mkhatib's full-sized avatar

Mohammad Khatib mkhatib

View GitHub Profile
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
#core_scaffold {
position: absolute;
top: 0px;
right: 0px;
@mkhatib
mkhatib / designer.html
Created August 17, 2014 09:12
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<polymer-element name="my-element">
<template>
<style>
@mkhatib
mkhatib / ag-mk-shortcut.js
Created June 18, 2013 04:41
Adds an AngularJS directive to add keyboard shortcuts for elements with ng-click directive.
var app = angular.module('app');
app.directive('mkShortcut', function($document) {
// Ref: http://goo.gl/7XDys
function fireEvent(element, event) {
if (document.createEvent) {
// dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
@mkhatib
mkhatib / app.js
Created January 14, 2016 07:31
Carbon Usage
var element = document.getElementById('editor');
var editor = new carbon.Editor(element, {
rtl: true,
modules: [carbon.EmbeddedComponent]
});
editor.install(carbon.EmbeddingExtension, {
embedProviders: {
embedly: new carbon.EmbedlyProvider({
apiKey: EMBEDLY_API_KEY
@mkhatib
mkhatib / app.js
Created January 14, 2016 07:29
Carbon Usage
var element = document.getElementById('editor');
var editor = new carbon.Editor(element, {
rtl: true,
modules: [carbon.EmbeddedComponent]
});
editor.install(carbon.EmbeddingExtension, {
embedProviders: {
embedly: new carbon.EmbedlyProvider({
apiKey: EMBEDLY_API_KEY
@mkhatib
mkhatib / manshar.com-service-worker.js
Created February 25, 2016 03:11
Service Worker with a problem of same hash with two different cache content on two different browsers.
'use strict';
importScripts("workers/sw-toolbox-workers.js");
var PrecacheConfig = [
["404.html", "85f3907148cdb68254687c3de7f89a25"],
["bower_components/angular-file-upload/dist/angular-file-upload-shim.min.js", "026ef609992ad0f8d1b02dae399a764b"],
["favicon.ico", "b2eb3d352ea4e8f74b160b46ccc881b9"],
["https://ajax.googleapis.com/ajax/libs/angularjs/1.3.17/angular.min.js", "cd13a2e1aad01b347ad15d5e201f39ee"],
["https://fonts.googleapis.com/earlyaccess/droidarabicnaskh.css", "0d94281129940b9c1a522545882c8293"],
["https://fonts.gstatic.com/ea/droidarabicnaskh/v7/DroidNaskh-Bold.ttf", "aedd83523a65f2c0dc4e2bad69b94534"],
["https://fonts.gstatic.com/ea/droidarabicnaskh/v7/DroidNaskh-Bold.woff", "78aa34ad512567cf0b5e7fc611ff3099"],
@mkhatib
mkhatib / randommodel.py
Created May 3, 2013 03:23
Abstract Random AppEngine ndb.Model. Extend this class and use .random method to get random entities/records.
import random
from google.appengine.ext import ndb
class RandomIndexedModel(ndb.Model):
"""Abstracts how we do randomness in the other models."""
random_index = ndb.FloatProperty('ri')
@classmethod
def random(cls, count=1, exclude=None, ancestor=None, filters=None):
@mkhatib
mkhatib / designer.html
Created August 1, 2014 03:22
designer
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
#core_drawer_panel {
position: absolute;
top: 420px;
right: 0px;
@mkhatib
mkhatib / appengine-service-accounts-on-devserver.md
Created September 23, 2017 06:54 — forked from pwalsh/appengine-service-accounts-on-devserver.md
Google App Engine Service Accounts that work in local development: A guide for the lost and weary

It is easy to get service accounts working with App Engine's app_devserver.py - once you know how.

On the way there, you might have pulled out all your hair following one documentation dead end after another, trying to piece together the right information.

Here are the steps you need to take, in exact order, to get this working. Once you follow these steps, you'll be able to use service accounts in local development, so that you can interact with Google APIs (e.g.: Spreadsheet, Calendar) in a way that is consistent with the deployment environment on App Engine.

In order to follow the instructions, you'll be better off using the latest UI for Google Cloud projects. Older interfaces (such as the dedicated App Engine dashboard) have things in different places, under different names, etc. It is a world of pain there.

Also note that I've tested this on several 1.9.x releases of App Engine; I can't confirm the behaviour of earlier releases.

Privacy Policy
----------------
### Introduction
Our privacy policy will help you understand what information we collect at *[Repeat Repeat]*, how *[Repeat Repeat]* uses it, and what choices you have.
*[Repeat Repeat]* built the *[Repeat Routine]* app as a free app. This SERVICE is provided by *[Repeat Repeat]* at no cost and is intended for use as is.
If you choose to use our Service, then you agree to the collection and use of information in relation with this policy. The Personal Information that we collect are used for providing and improving the Service. We will not use or share your information with anyone except as described in this Privacy Policy.
The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible in our website, unless otherwise defined in this Privacy Policy.
### Information Collection and Use