Skip to content

Instantly share code, notes, and snippets.

View sandeepthukral's full-sized avatar

Sandeep Thukral sandeepthukral

View GitHub Profile
@sandeepthukral
sandeepthukral / index.html
Last active August 29, 2015 14:08 — forked from anonymous/index.html
Even and Odd in ngRepeat
<!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 {
@sandeepthukral
sandeepthukral / ng-repeat-key-value
Created April 1, 2015 11:30
key, value in ng-repeat
<tr ng-repeat="(key, value) in data">
<td> {{key}} </td> <td> {{ value }} </td>
</tr>
@sandeepthukral
sandeepthukral / npm-config-proxy
Created April 7, 2015 08:40
How to configure proxy for npm
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
@sandeepthukral
sandeepthukral / gist:f3feed686656eedd5bf3
Last active August 29, 2015 14:22
Export HTML table to Excel in AngularJS

Export HTML table to Excel in AngularJS

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 {
@sandeepthukral
sandeepthukral / LICENSE
Last active August 29, 2015 14:27 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
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:
@sandeepthukral
sandeepthukral / python_ignore_unicode_in_string.py
Last active December 17, 2019 09:17
python - remove annoying 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!
@sandeepthukral
sandeepthukral / 0_reuse_code.js
Created March 18, 2017 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@sandeepthukral
sandeepthukral / count-numbers.js
Created September 14, 2018 09:45
Count numbers on a webpage using Developer Console and JS
p = $('.btn.btn-pill')
s = 0; p.each((idx, e) => s += parseInt(e.lastChild.textContent.trim())); console.log(s)
@sandeepthukral
sandeepthukral / README.md
Created September 14, 2018 10:32
Count numbers on a webpage using Developer Console and JS. Change the selector on line 1 and , if required, the lastChild thing on the second.
@sandeepthukral
sandeepthukral / bookmarklet-nl-wiktionary-vervoeging.js
Created December 17, 2019 09:07
Bookmarklet to open information page for any Dutch verb
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;
}
}