This file contains 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.lukehorvat; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.os.Parcel; | |
import android.os.Parcelable; | |
import android.preference.DialogPreference; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.widget.NumberPicker; |
This file contains 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.lukehorvat; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.os.Parcel; | |
import android.os.Parcelable; | |
import android.preference.DialogPreference; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.widget.SeekBar; |
This file contains 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
//determine the brightness range of this thread's image strip | |
Tuple brightnessRange = GetImagePartBrightnessRange(image, startX, startY, finishX, finishY); | |
//update the global brightness range of the entire image | |
lock (_lock) | |
{ | |
minBrightness = Math.Min(minBrightness, brightnessRange.Item1); | |
maxBrightness = Math.Max(maxBrightness, brightnessRange.Item2); | |
} |
This file contains 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
from esec import esdl_eval | |
from esec.species.tgp import Instruction, DecisionInstructionWithState | |
from esec.landscape.tgp import TGPFitness | |
#define the attributes of a Saturday morning | |
OUTLOOK = ('SUNNY', 'OVERCAST', 'RAIN') | |
HUMIDITY = ('HIGH', 'NORMAL') | |
WINDY = (True, False) | |
#define the state object to store attributes of a Saturday morning |
This file contains 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
instructions = [ | |
DecisionInstructionWithState(lambda fitness_case: 1 if fitness_case.outlook == 'SUNNY' else (2 if fitness_case.outlook == 'OVERCAST' else 3), param_count=3, name='OUT'), | |
DecisionInstructionWithState(lambda fitness_case: 1 if fitness_case.humidity == 'HIGH' else 2, param_count=2, name='HUM'), | |
DecisionInstructionWithState(lambda fitness_case: 1 if fitness_case.windy else 2, param_count=2, name='WIND'), | |
] |
This file contains 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
cd %~dp0 | |
mkdir converted | |
FOR %%A IN (%*) DO ( | |
sox %%A "converted/%%~nxA" reverse trim 4.3 reverse trim 0.3 gain -n -1 | |
lame -V7 converted/%%~nxA | |
) | |
pause |
This file contains 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
var newGridCellValue = '', | |
deleteGridCellValue = false; | |
Ext.define('ExcelCellEditing', { | |
extend: 'Ext.grid.plugin.CellEditing', | |
alias: 'plugin.excelcellediting', | |
initEditTriggers: function () { | |
var me = this; |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Routes</title> | |
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"> | |
</head> | |
<body> |
This file contains 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
.config ($httpProvider) -> | |
$httpProvider.interceptors.push ($q, $rootScope, apiUrl, authToken) -> | |
request: (config) -> | |
# Intercept API requests and inject the auth token. | |
config.headers["X-Auth-Token"] = authToken if config.url.indexOf(apiUrl) is 0 and authToken? | |
config or $q.when config | |
responseError: (response) -> | |
# Intercept unauthorised API responses and fire an event. |
This file contains 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
let map = new Map(); | |
map.set("a", 1); | |
map.set("b", 2); | |
map.set("c", 3); | |
let obj = Array.from(map).reduce((obj, [key, value]) => ( | |
Object.assign(obj, { [key]: value }) // Be careful! Maps can have non-String keys; object literals can't. | |
), {}); | |
console.log(obj); // => { a: 1, b: 2, c: 3 } |
OlderNewer