Skip to content

Instantly share code, notes, and snippets.

// the number of setbits in an integer.
// worst case scenario is Number.MAX_SAFE_INTEGER = 2^53 - 1
// O(log(N)) where N is number of bits
function numberOfSetBits(number: number): number {
let setBits = 0;
while (number > 0) {
if ((number & 0x01) == 1) {
setBits++;
}
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
/**
* UTF-8 friendly ResourceBundle support
*
* Utility that allows having multi-byte characters inside java .property files.
* It removes the need for Sun's native2ascii application, you can simply have
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ruiaraujo
ruiaraujo / designer.html
Created October 30, 2014 10:08
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-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../paper-radio-group/paper-radio-group.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
@ruiaraujo
ruiaraujo / designer.html
Last active August 29, 2015 14:08
designer
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
These first four lead nowhere
Error: goo.gl/3F5QCB
Error: goo.gl/9gPllz
Error: goo.gl/flabRh
Error: goo.gl/p5cxV6
goo.gl/06Hov3
goo.gl/0gNnSE
goo.gl/1AiXEk
goo.gl/1QTi2T
goo.gl/1Z2jVD