Skip to content

Instantly share code, notes, and snippets.

View darkowlzz's full-sized avatar

Sunny darkowlzz

  • ‏‏‏‏‎ ‎
View GitHub Profile
l = 'XYZ'
#def stringOccurrences(int n, String str):
def pandovan(n):
p = []
for i in range(0,n):
if i<3:
l = 'XYZ'
def pandovan(n):
p = []
for i in range(0,n):
if i<3:
p.append(l[i])
else:
p.append(p[i-2] + p[i-3])
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pebblemerchant;
/**
*
* @author sunny
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const { setTimeout } = require('sdk/timers');
const utils = require('sdk/lang/functional');
const { invoke, defer, curry, compose, memoize, once, delay, wrap } = utils;
exports['test forwardApply'] = function(assert) {
function sum(b, c) this.a + b + c
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const { setTimeout } = require('sdk/timers');
const utils = require('sdk/lang/functional');
const { invoke, defer, curry, partial, compose, memoize, once, delay, wrap } = utils;
const deprecate = require('sdk/util/deprecate');
const { LoaderWithHookedConsole } = require('sdk/test/loader');
let Histogram = {
hgramSamplesCaption: bundle.GetStringFromName("histogramSamples"),
hgramAverageCaption: bundle.GetStringFromName("histogramAverage"),
hgramSumCaption: bundle.GetStringFromName("histogramSum"),
hgramCopyCaption: bundle.GetStringFromName("histogramCopy"),
258 let labelledItemRules = mix(baseItemRules, {
259 label: {
260 map: stringOrNull,
261 is: ["string"],
262 ok: function (v) !!v,
263 msg: "The item must have a non-empty string label."
264 },
265 image: {
266 map: stringOrNull,
267 is: ["string", "undefined", "null"],
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
module.metadata = {
'stability': 'unstable'
};
const { Cc, Ci } = require('chrome');
exports['test new top window with content URI'] = function(assert) {
let msg = 'only chrome, resource and data uris are allowed';
assert.throws(function () {
open('foo');
}, msg);
assert.throws(function () {
open('http://foo');
}, msg);
assert.throws(function () {
open('https://foo');
let { promise } = require('sdk/window/helpers');
console.log("foo1");
promise(open('chrome://foo/content/'), 'load').then(function(window) {
console.log("foo2");
assert.ok(~windows().indexOf(window), 'chrome URI works');
console.log("foo3");
return window; // pass window to next function
}).then(close).
then(promise.bind(null, 'resource://foo', 'load')).then(function(window) {
assert.ok(~windows().indexOf(window), 'resource URI works');