This file contains hidden or 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
/* | |
* This file is a ported version of | |
* http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/test/jtreg/util/concurrent/TimeUnit/Basic.java?view=co | |
* which contained the following header: | |
*/ | |
/* | |
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. | |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
* |
This file contains hidden or 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
package com.lchau; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.concurrent.TimeUnit; | |
public class Program { | |
public static void main(String[] args) { |
This file contains hidden or 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
if (window.location.host === "instagram.com" && window.location.pathname.startsWith("/p/")) { | |
var images = document.querySelectorAll(".-cx-PRIVATE-Photo__image"); | |
var length = images.length; | |
if (length) { | |
var element = images[length - 1]; | |
if (element.src) { | |
window.location.href = element.src; | |
} | |
} | |
} |
This file contains hidden or 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
export default Ember.Component.extend({ | |
fadeDurationInMilliseconds: 300, | |
didInsertElement() { | |
let duration = this.get("fadeDurationInMilliseconds"), | |
element = this.$(); | |
element.fadeIn(duration); | |
}, | |
This file contains hidden or 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
/** | |
* Inline Edit Component | |
* | |
* @author lamchau | |
*/ | |
import Ember from "ember"; | |
import KeyCodes from "utils/key-codes"; | |
const DOUBLE_CLICK_COUNT = 2; | |
const SINGLE_CLICK_COUNT = 1; |
This file contains hidden or 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
Object.prototype[Symbol.iterator] = function() { | |
let self = this; | |
let keys = null; | |
let length = 0; | |
let index = -1; | |
return { | |
next() { | |
if (keys === null) { | |
keys = Object.keys(self); |
This file contains hidden or 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(I18n) { | |
if (!I18n) { | |
throw new Error('Missing dependency: I18n'); | |
} | |
var translate = I18n.translate; | |
var slice = [].slice; | |
/** | |
* // en.js |
This file contains hidden or 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 demethodize(fn) { | |
if (typeof fn === "function") { | |
return Function.bind.bind(Function.call)(fn); | |
} | |
return null; | |
} | |
_.mixin((function() { | |
return { | |
demethodize: function(fn) { |
This file contains hidden or 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 humanizeBytes(bytes, si) { | |
unit = si ? 1e3 : 1024; | |
var byteSuffix = (si ? 'b' : 'B'); | |
if (bytes < unit) { | |
return bytes + byteSuffix; | |
} | |
var modifier = Math.floor(Math.log(bytes) / Math.log(unit)); | |
var prefix = (si ? 'kMGTPEZ' : 'KMGTPEZ')[modifier - 1]; | |
if (!si) { |
This file contains hidden or 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 orderByProperty(prop) { | |
var args = [].slice.call(arguments, 1); | |
return function (a, b) { | |
var propA = a[prop]; | |
var propB = b[prop]; | |
var result; | |
if (typeof propA == 'string' || typeof propB == 'string') { | |
result = String(propA).localeCompare(propB); | |
} else { |