Skip to content

Instantly share code, notes, and snippets.

View kix's full-sized avatar

Stepan Anchugov kix

View GitHub Profile
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
#include <PMserial.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEScan.h>
#include <BLEAdvertisedDevice.h>
#include <BLE2902.h>
#define SERVICE_UUID "faf6c799-5567-4f54-89fb-c7188b3f3b88"
#define CHARACTERISTIC_PM01_UUID "cc4f2f18-7b99-4fae-b46d-3568a42cb3f8"
#define CHARACTERISTIC_PM25_UUID "d7f6bea5-4e01-458d-9395-9e42ddd00b69"
@kix
kix / telegram.clj
Last active December 5, 2019 16:47
(ns taskbot.telegram
(:require [clj-http.client :as http]
[cheshire.core :as json]
[clojure.core.async :as a :refer [chan put! close! take! go go-loop <! >! alts!]]
[environ.core :refer [env]]
[clojure.tools.logging :as log]
[clojure.spec.alpha :as s]
[clojure.spec.test.alpha :refer [instrument]]))
(def base-url (or (env :base-url) "https://api.telegram.org/bot"))
@kix
kix / chart.html
Created July 3, 2012 11:27
Highcharts with custom HTML/CSS buttons
<div class="zoom_controls">
<span><?php echo $this->tr('Zoom:')?></span>
<a href="#" data-chart="line" data-range="1m">1m</a>
<a href="#" data-chart="line" data-range="3m">3m</a>
<a href="#" data-chart="line" data-range="6m">6m</a>
<a href="#" data-chart="line" data-range="1y">1y</a>
<a href="#" data-chart="line" data-range="Ytd">YTD</a>
<a href="#" data-chart="line" data-range="All">All</a>
</div>
@kix
kix / silex-sf2-controllers.rst
Created October 16, 2012 04:29
How to use controllers like in Symfony2 framework

How to use controllers like in Symfony2 framework

In Silex, the most common way to define the controller of a route is with a closure. But when your project gets bigger, you want to organize your code in classes. You can use the syntax ClassName::methodName in your route definition instead of a function () { ... } but you have to inject the Silex\Application $app as a parameter on each method of your controller class, which can become quite boring.

const webpack = require('webpack')
const path = require('path')
const devBuild = process.env.NODE_ENV !== 'production'
const nodeEnv = devBuild ? 'development' : 'production'
const config = {
entry: {
'client-bundle': [ 'babel-polyfill', 'whatwg-fetch', './app/Resources/js/main.js' ],
@kix
kix / twig-ref.textile
Created January 31, 2012 10:39
Twig reference

Twig is the Chyrp templating engine. It is authored by Armin Ronacher, who was generous enough to jump on the chance to build us a templating engine. The syntax in general is “similar to the Genshi text templates which in turn were inspired by Django which also inspired Jinja (all three of them python template engines) which inspired the Twig runtime environment.”

Twig’s Purpose

A language independent and simple template engine is useful for applications that use code which is written in more than one programming language. Good Examples are portal systems which use a blog written in Ruby, a forum software written in PHP and a planet system written in Python.

While it was written for Chyrp exclusively, you should fairly easily be able to use it in any other system you want to use it in. Currently there is only one implementation, and that is in PHP. If you want to port it to another language, a spec sheet can be found in /includes/class/Twig/spec.html.

Terminology

<?php
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class ServiceTest extends KernelTestCase
{
public function provideExpectedDefinitions()
{
return [
['My\Something', 'my.something'],
<?php
/**
* WebTestCase client-aware test case
*/
trait ClientAware
{
/**
* @var \Symfony\Bundle\FrameworkBundle\Client
*/
private $client;
@kix
kix / GoodSEO.feature
Created May 20, 2013 08:43
Automated SEO checking!
Feature: Good SEO
As a worried customer
I expect my SEO to be good
Scenario: My SEO is good
When I search for "скачать бесплатно без регистрации и смс" on "http://google.com"
Then my shitty website should be at least on the "4"th line