Skip to content

Instantly share code, notes, and snippets.

Damir Fakhrutdinov ramainen

  • Russia
Block or report user

Report or block ramainen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ramainen
ramainen / App.js
Last active May 17, 2018
Примеры интеракций
View App.js
import React, { Component } from 'react';
import './App.css';
import Titler from './Titler'
import {observer, inject} from 'mobx-react';
@inject("model")
@observer
View vibrate.js
$(".button").click(function(){
$(".button").vibrate(50);
});
View projecter.go
package main
import (
"fmt"
"html"
"log"
"net"
"net/http"
"os"
"runtime"
View pages.sql
CREATE TABLE `pages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`url` text,
`text` text,
`title` text,
`page_id` int(11) DEFAULT NULL,
`template` varchar(255) DEFAULT NULL,
`type` varchar(255) DEFAULT NULL,
`multi_domain` varchar(255) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
View recepy.md
  1. Жарим мясо на сковороде.
  2. Подкидываем в мясо лук и морковь, обжариваем.
  3. Подкидываем пару столовых ложек муки
  4. Сразу подкидываем пару столовых ложек майонеза и столько же кетчупа
  5. Чайная ложка сахара, соль по вкусу
  6. Заливаем водой, мешаем, чтобы не было комков, тушим. (если мясо готово при обжарке, достаточно дать закипеть)

Готово

View designer.html
<link rel="import" href="../topeka-elements/avatars.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-pages/core-pages.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
View samle.md
//Sample I use
socket.on('disconnect', function() {
	if(typeof(socket._room) != 'undefined'){
		for(key in socket._room){
			if(Object.keys(io.sockets.adapter.rooms[socket._room[key]]).length == 0){
				delete io.sockets.adapter.rooms[socket._room[key]];
			}
		}
	}
	delete io.sockets.adapter.rooms[socket.id];
View sample.md

Client:

var table_id = 1; // example, python will give this value

var socket = io('http://localhost:3000/table'+table_id');
socket.on('connect', function() {
	console.log('Connected');
	socket.emit('join', "table_"+table_id);
});
View sample.html
<script src="/cms/external/socket.io.js"></script>
<script>var socket = io("http://cloud.doit-cms.ru");socket.emit("register", { userid: "75b0390c23ecef9109e66d0b352a1a66" });</script>
<script>
//бизнес логика
View gist:514a76743bedbbc7bbf3
<?php
function download_file($adress){
$adress = str_replace('+',' ',$adress);
$file = d()->File->where('title = ?',$adress);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header("Content-Disposition: attachment; filename*=UTF-8''".rawurlencode( $file->title).'.'.$file->ext."");
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
You can’t perform that action at this time.