Markdown és un llenguatge de marcat lleuger per donar format simple a textos.
- Estàndard (més o menys)
- Simple
Compile a Processing sketch into a library that can be used with an import. This is helpful to reduce the amount of Processing tabs in a project, specially for that bunch of classes that won't be changed and belong to a same conceptual group.
Translate Processing's .pde
files to .java
files, getting rid of all the Processing core functions by java equivalents (ex. sin()
to Math.sin()
) and/or import Processing classes (ex. PVector
).
Add package name at the beginning of every java class file.
Open Terminal and go to sketch's directory. Type the following command
javac -cp [processing_path]:[extra_libraries] -source 1.6 -target 1.6 -d . *.java
export default (chars = 'ABCDEFGHJKMNPQRSTUVWXYZ0123456789') => { | |
const checksum = input => { | |
const { sum } = input.split('').reverse().reduce((acc, char) => { | |
const addend = acc.factor * chars.indexOf(char); | |
acc.factor = acc.factor === 2 ? 1 : 2; | |
acc.sum += Math.floor(addend / chars.length) + (addend % chars.length); | |
return acc; | |
}, { sum: 0, factor: 2 }); | |
const remainder = sum % chars.length; | |
return chars[(chars.length - remainder) % chars.length]; |
/** | |
* import StaggerDirective from '@/utils/directive.stagger'; | |
* Vue.directive('stagger', StaggerDirective); | |
* | |
* Optional directive value selects elements through CSS selectors v-stagger="'.stagger-item'" | |
* Optional argument defines generic stagger interval v-stagger:250 (default: 100ms) | |
* Optional data-stagger for single item delay | |
*/ | |
export default { |
<?php | |
/* Validation schema example */ | |
$schema = [ | |
'id' => ['field' => 'id'], | |
'name' => [ | |
'field' => 'name', | |
'required' => true, | |
'validation' => ['type' => 'string'] | |
], |
<?php | |
/* Cache proxy for darksky.net API requests */ | |
define('API_KEY', '***********************'); | |
define('TIMEOUT', 10 * 60); // In seconds (10 minutes) | |
// Coordinates MUST be the first element in URL as https://api.server.io/v1/weather/[LAT,LON] | |
$params = explode('/', trim($_SERVER['PATH_INFO'], '/')); | |
$coords = filter_var(array_shift($params), FILTER_SANITIZE_STRING); | |
// Validate coordinates |
export default { | |
bind(el, bindings) { | |
el.dragEvents = ['dragenter', 'dragover', 'dragleave', 'drop']; | |
el.dragEvents.forEach(dragEvent => { | |
el.addEventListener(dragEvent, (event) => { | |
if (!el.classList.contains(dragEvent)) { | |
el.classList.remove(...el.dragEvents); | |
el.classList.add(dragEvent); | |
} | |
event.preventDefault(); |
export default { | |
bind(el, binding) { | |
const { value: { msg, callback } } = binding; | |
el.ask = () => { | |
if (confirm(msg)) callback(); | |
}; | |
el.addEventListener('click', el.ask); | |
}, | |
unbind(el) { el.removeEventListener('click', el.ask); } | |
}; |