Qt .pro/QML (with a chapter for git)
.
.
use jscrambler
- use jscrambler, with config entry "propertyKeysObfuscation"
- Take care: this hint is not hacker-safe, but often ~good-enough!
- cfg prop: "name": "propertyKeysObfuscation"
npm install jscrambler --save-dev
npm i --save-dev jscrambler-webpack-plugin
Use Avocode (desktop app, available for macOS, Win, Linux)
- Use Avocode (the app is not free) (can also handle Sketch designs with a plugin)
- After opening the project, you can edit the CSS styles.
- can export images
- often, you edit the HTML manually and use the styles & images given by Avocode
- app shows padding & margin of elements visually
Use online service of http://www.browserstack.com (not free!)
- Can do:
- live: interactive test & debug of websites in real browsers & mobile devices
- Automate
- Screenshots & Responsive
- you can choose from a lot of browser-versions & OSs(Win, macOS, iOS, Android)
- Plugin for Chrome: 'Local Testing' for non-public websites, eg. from localhost
Use mod_pagespeed: it compresses JS & CSS
wget https://dl-ssl-google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb
dpkg -i mod-pagespeed*.deb
sudo service apache2 restart
gedit /etc/apache2/mods-available/pagespeed.conf # -> ModPagespeed on|off
gedit /etc/apache2/mods-enabled/pagespeed.conf # -> /pagespeed_admin = Admin Area!
sudo service apache2 reload
/etc/apache2/mods-available/pagespeed.conf
<IfModule pagespeed_module>
ModPagespeed on
...
/etc/apache2/mods-enabled/pagespeed.conf
<Location /pagespeed_admin>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
Allow from 0.0.0.0
SetHandler pagespeed_admin
</Location>
<Location /pagespeed_global_admin>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
Allow from 0.0.0.0
SetHandler pagespeed_global_admin
</Location>
ModPagespeedStatisticsLogging on
select avg3.title, avg3.avg_rating
from
(select b.title, avg(r.rating) as avg_rating from ratings r join books b on b.id = r.book_id group by b.title) as avg3
where avg_rating = (select min(avg2.avg_rating2) from (select r2.book_id as id, avg(r2.rating) as avg_rating2 from ratings r2 group by r2.book_id) as avg2);
(incomplete)
public class OrdersAnalyzer {
/**
* Should return at most three most popular products. Most popular product is the product that have the most occurrences
* in given orders (ignoring product quantity).
* If two products have the same popularity, then products should be ordered by name
*
* @param orders orders stream
* @return list with up to three most popular products
*/
public List<Product> findThreeMostPopularProducts(Stream<Order> orders) {
List<Product> ps = new ArrayList<Product>();
Stream<OrderLine> ols = orders.flatMap((order) -> order.getOrderLines().stream());
Map<Product, Integer> acc = new HashMap();
ols.forEach(ol -> acc.merge(ol.getProduct(), ol.getQuantity(), Math::addExact));
acc.entrySet().stream().sorted(Map.Entry.comparingByValue()).limit(3).forEachOrdered(p -> ps.add(p.getKey()));
return ps;
}
/**
* Should return the most valuable customer, that is the customer that has the highest value of all placed orders.
* If two customers have the same orders value, then any of them should be returned.
*
* @param orders orders stream
* @return Optional of most valuable customer
*/
public Optional<Customer> findMostValuableCustomer(Stream<Order> orders) {
List<Customer> cs = new ArrayList<Customer>();
Map<Customer, Integer> acc = new HashMap();
orders.forEach(order -> acc.merge(order.getCustomer(), value(order.getCustomer(), order.getOrderLines()), Math::addExact));
return acc.entrySet().stream().sorted(Map.Entry.comparingByValue()).map(ac -> ac.getKey()).findFirst();
}
private Integer value(Customer c, Set<OrderLine> ols) {
int i = ols.stream().mapToInt(ol -> ol.getProduct().getPrice().intValue() * ol.getQuantity()).sum();
System.out.println(""+c.getFirstName()+" "+c.getLastName()+" -> val: "+i);
return i;
}
}
//solution 1:
function sum(n1)
{
return function(n2) {
return function (n3) {
return n1 + n2 + n3;
}
}
}
//alert(sum(2)(3)(4)); //should be 9
//solution 2: ES6
var sum = n1 => n2 => n3 => n1 + n2 + n3;
//alert(sum(2)(3)(4)); //should be 9
How to combine html files of a directory into one single html file containing all the small file contents?
copy *.html all.html
Advantage: automatic JSON <-> JS object conversion works
(e.g. from the return of REST calls)
(in contrast to the Map type)
//declare
let mymap: {[id: string]: boolean};
//lookup
if (mymap[id2Look4]) { doSomething(); }
//iterate
Object.keys(mymap).forEach(key => ...);