myApp.factory('Excel',function($window){
var uri='data:application/vnd.ms-excel;base64,',
template='<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
base64=function(s){return $window.btoa(unescape(encodeURIComponent(s)));},
format=function(s,c){return s.replace(/{(\w+)}/g,function(m,p){return c[p];})};
return {
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
<!doctype html> | |
<html ng-app="myApp"> | |
<head> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/foundation/4.3.2/css/foundation.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.js"></script> | |
<style id="jsbin-css"> | |
.odd { | |
background-color: blue; | |
} | |
.even { |
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
<tr ng-repeat="(key, value) in data"> | |
<td> {{key}} </td> <td> {{ value }} </td> | |
</tr> |
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
npm config set proxy http://proxy.company.com:8080 | |
npm config set https-proxy http://proxy.company.com:8080 | |
My password had a @ and a % in it, but url encoding it (and then not putting quotes around) worked for me | |
I struggled a bit because I have a @ character in my password :-) | |
The solution is to surround the username and password in quotes | |
npm config set proxy http://"user:P@ssword"@proxy.server:1234 |
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
The MIT License (MIT) | |
Copyright (c) 2015 Justin Perry | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
the Software, and to permit persons to whom the Software is furnished to do so, | |
subject to the following conditions: |
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
s = 'This is some \\u03c0 text that has to be cleaned\\u2026! it\\u0027s annoying!' | |
print(s.decode('unicode_escape').encode('ascii','ignore')) # This is some text that has to be cleaned! it's annoying! |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
p = $('.btn.btn-pill') | |
s = 0; p.each((idx, e) => s += parseInt(e.lastChild.textContent.trim())); console.log(s) |
This gist works on the following page http://support.vanmoof.com/
The code is used, in this case, to count the total number of topics there are on this support page.
The basic idea is to first get the elements whose text you are interested in. https://developers.google.com/web/tools/chrome-devtools/console/command-line-reference
The $() returns an array of Element objects https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
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
javascript: | |
(function() { | |
var prefix = "https://nl.wiktionary.org/wiki/"; | |
var suffix = "/vervoeging"; | |
var woord = prompt("Welk woord zoek je informatie over?", "leggen"); | |
if (woord != null) { | |
loc = prefix + woord.trim() + suffix; | |
location.href = loc; | |
} | |
} |
OlderNewer