- A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
- lengths are in any unit (ex: pixels)
- code snippets are in JavaScript
angleRad = angleDeg * Math.PI / 180;
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
/* DeviceUID.h | |
#import <Foundation/Foundation.h> | |
@interface DeviceUID : NSObject | |
+ (NSString *)uid; | |
@end | |
*/ | |
// Device.m |
check process hhvm with pidfile /var/run/hhvm/pid | |
group hhvm | |
start program = "/usr/sbin/service hhvm start" with timeout 60 seconds | |
stop program = "/usr/sbin/service hhvm stop" | |
if failed unixsocket /var/run/hhvm/hhvm.sock then restart | |
if mem > 400.0 MB for 1 cycles then restart | |
if 5 restarts with 5 cycles then timeout |
#!/usr/bin/env ruby -KU | |
# | |
# This code has been adapted from | |
# https://github.com/google/google-api-ruby-client-samples/tree/master/drive | |
# | |
require 'thor' | |
require 'hirb' | |
require 'google/api_client' | |
require 'google/api_client/client_secrets' |
LAContext *myContext = [[LAContext alloc] init]; | |
NSError *authError = nil; | |
NSString *myLocalizedReasonString = @"Authenticate using your finger"; | |
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) { | |
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics | |
localizedReason:myLocalizedReasonString | |
reply:^(BOOL success, NSError *error) { | |
if (success) { | |
NSLog(@"User is authenticated successfully"); | |
} else { |
<?php | |
/* | |
HHVMinfo - phpinfo page for HHVM HipHop Virtual Machine | |
Author: _ck_ | |
License: WTFPL, free for any kind of use or modification, I am not responsible for anything, please share your improvements | |
Version: 0.0.6 | |
* revision history | |
0.0.6 2014-08-02 display fix for empty vs zero | |
0.0.5 2014-07-31 try to determine config file from process command line (may not always work), style improvements |
;extension = /usr/lib64/php/modules/geoip.so | |
hhvm.pid_file = "/var/run/hhvm/hhvm.pid" | |
hhvm.server.port = 9000 | |
hhvm.server.fix_path_info = true | |
hhvm.server.type = fastcgi | |
hhvm.server.enable_magic_quotes_gpc = false | |
hhvm.server.enable_keep_alive = true | |
hhvm.server.enable_ssl = true | |
hhvm.log.access_log_default_format = "%h %l %u %t \"%r\" %>s %b" |
'use strict'; | |
module.exports = function(grunt) { | |
// load all grunt tasks | |
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | |
// configurable paths | |
var paths = { |