Skip to content

Instantly share code, notes, and snippets.

@enniel
enniel / counter.json
Created February 20, 2025 03:24
Flex Counter Example
{
"metadata": {
"title": "Counter"
},
"state": {
"count": 0
},
"debug": {
"message": "debug counter",
"params": {
@enniel
enniel / useCarousel.ts
Created October 9, 2019 21:54 — forked from FlorianRappl/useCarousel.ts
The generic useCarousel hook.
import { useReducer, useEffect } from 'react';
import { useSwipeable, SwipeableHandlers, EventData } from 'react-swipeable';
function previous(length: number, current: number) {
return (current - 1 + length) % length;
}
function next(length: number, current: number) {
return (current + 1) % length;
}
@enniel
enniel / convert.sh
Created December 17, 2018 11:06 — forked from akost/convert.sh
Bash script for recursive file convertion windows-1251 --> utf-8
#!/bin/bash
# Recursive file convertion windows-1251 --> utf-8
# Place this file in the root of your site, add execute permission and run
# Converts *.php, *.html, *.css, *.js files.
# To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command
find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f |
while read file
do
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
buildscript {
ext.kotlin_version = '1.2.0'
repositories {
[vhod1]
exten => s,1,Answer
exten => s,n,Background(menuvhod/vhod1)
exten => s,n,WaitExten(30)
;
;Первый вариант если заказчик и есть 1 заказ.
;Ваш заказ выполняется. для соединения с менеджером нажмите 0 или оставайтесь на линии.
;для соединения с исполнителем нажмите 1.
;
exten => 0,1,Goto(from-internal,${MANAGER_PHONE},1)
import color from 'color';
import { Platform, Dimensions, PixelRatio } from 'react-native';
const deviceHeight = Dimensions.get('window').height;
const deviceWidth = Dimensions.get('window').width;
const platform = Platform.OS;
const platformStyle = 'material';
export default {
'use strict'
const Command = use('Command')
const Model = use('App/Model/Greet')
class Greet extends Command {
/**
* signature defines the requirements and name
* of command.
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super(...arguments);
let items = this.get('items'), id = 0;
if (items.length > 0) {
id = items.get('lastObject');
++id;
}
@enniel
enniel / components.child-component.js
Last active September 26, 2016 13:30
New Twiddle
import Ember from 'ember';
const { computed: { alias } } = Ember;
export default Ember.Component.extend({
classNameBindings: [
'isActive'
],
isActive: alias('data.isActive'),
init() {
this._super();
import Ember from 'ember';
const { ObjectProxy, computed: { alias } } = Ember;
export default Ember.Component.extend({
classNameBindings: [
'isActive'
],
isActive: alias('data.isActive'),
init() {
this._super();