This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="../paper-calculator/paper-calculator.html" rel="import"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
#design_host { | |
position: absolute; | |
width: 100%; | |
height: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function absScriptLoc(filename) { | |
var scriptElements = document.getElementsByTagName('script'); | |
for (var i = 0; i < scriptElements.length; i++) { | |
var source = scriptElements[i].src; | |
if (source.indexOf(filename) > -1) { | |
var location = source.substring(0, source.indexOf(filename)) + filename; | |
return location; | |
} | |
} | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getTitle() { | |
var title = document.getElementById('title').value; | |
} | |
function getContent() { | |
var content = ''; | |
if (tinyMCE.editors[0]) { | |
content = tinyMCE.editors[0].getContent().replace(/^<p>|<\/p>$/g, ''); | |
} else { | |
content = document.querySelector('#content-textarea-clone').innerHTML; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('bluebird'); | |
var callbackHellTimeout = function(cb, time) { | |
setTimeout(function() { | |
cb(); | |
}, time); | |
}; | |
var promiseTimeout = function(time) { | |
return new Promise(function(resolve, reject) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import docker | |
client = docker.DockerClient(base_url='unix://var/run/docker.sock') | |
def getMe(): | |
ip = socket.gethostbyname(socket.gethostname()) | |
containers = client.containers.list() | |
for container in containers: | |
containerIP = container.attrs['NetworkSettings']['Networks']['bridge']['IPAddress'] | |
if (ip == containerIP): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import os | |
os.system('cd ~/Android/Sdk/tools') | |
AVDs = [file.split('.')[0] for file in os.listdir(os.path.expanduser('~/.android/avd/')) if file.split('.')[len(file.split('.'))-1] == 'ini'] | |
i = 0 | |
for avd in AVDs: | |
i += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('lodash'); | |
console.log(combinations('abc')); | |
function combinations(chars) { | |
return getCombinations(chars.length, chars); | |
} | |
function getCombinations(count, chars, word) { | |
var combinations = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.internet import reactor | |
def main(): | |
reactor.addSystemEventTrigger('during', 'bang', bangHandler) # 3 listening for bang event - when heard, bangHandler() will be called | |
loadingGun() # 4 loadingGun() called | |
def loadingGun(): | |
print('Loading gun . . .') | |
reactor.callLater(5, aimingGun) # 5 after 5 seconds aimingGun() called | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Promise = require('bluebird'); | |
var callbackHellTimeout = function(cb, time) { | |
setTimeout(function() { | |
cb(); | |
}, time); | |
}; | |
var promiseTimeout = function(time) { | |
return new Promise(function(resolve, reject) { |