Skip to content

Instantly share code, notes, and snippets.

View supostat's full-sized avatar
🎯
Focusing

Igor Pugachev supostat

🎯
Focusing
View GitHub Profile
@supostat
supostat / git.md
Last active March 21, 2018 08:27
Git presentation

Мы подошли к трём основным секциям проекта Git: Git-директория (Git directory), рабочая директория (working directory) и область подготовленных файлов (staging area).

Git-директория — это то место, где Git хранит метаданные и базу объектов вашего проекта. Это самая важная часть Git, и это та часть, которая копируется при клонировании репозитория с другого компьютера.

Рабочая директория является снимком версии проекта. Файлы распаковываются из сжатой базы данных в Git-директории и располагаются на диске, для того чтобы их можно было изменять и использовать.

Область подготовленных файлов — это файл, располагающийся в вашей Git-директории, в нём содержится информация о том, какие изменения попадут в следующий коммит. Эту область ещё называют “индекс”, однако называть её stage-область также общепринято.

Базовый подход в работе с Git выглядит ...

@supostat
supostat / Internship.js
Last active December 29, 2017 07:32
Internship
1. https://github.com/facebookincubator/create-react-app
2. Layout and css: https://codepen.io/SitePoint/pen/brmXRX
3. https://medium.freecodecamp.org/all-the-fundamental-react-js-concepts-jammed-into-this-single-medium-article-c83f9b53eac2
4. ES2015: https://learn.javascript.ru/es-modern-usage
5. https://github.com/reactjs/react-modal
@supostat
supostat / shityCode.js
Created December 25, 2017 12:31
Shity Code
renderShiftList() {
const shiftList = [];
let count = 0;
var shift;
let month = '';
let isToDrawLine = false;
if (this.state.rotaShiftArray.length > 0) {
shift = this.state.rotaShiftArray[0];
}
if ((shift != null && shift.startDate >= this.getMonday((new Date())))) {
@supostat
supostat / immutable.md
Last active January 26, 2018 05:29
Immutable presentation

Immutable data in React & Redux Immutable.js 1. Как работает 1. Directed Asynclyc Grahp (DAG) 2. Index Trie 3. Hash Trie 2. Почему это нужно 1. Проблемы мутабельности в Javascript 2. Решение проблем с помощью Immutable.js 30-40 минут

@supostat
supostat / ably.js
Created November 27, 2017 12:10
Ably example code
handleSignInSuccess = ({token, ablyToken, presenceChannel, personalChannel}) => {
return new Promise((resolve, reject) => {
this.presenceChannel = presenceChannel;
this.personalChannel = personalChannel;
this.ably = new Ably.Realtime({authUrl: '/api/security_app/v1/sessions/ably_auth', authHeaders: {
Authorization: `Token token="${token}"`
}});
this.ably.connection.once('failed', () => {
<?php
/**
* Created by PhpStorm.
* User: supostat
* Date: 01.03.16
* Time: 10:03
*/
namespace frontend\modules\v1\controllers;
public function actionSuccess($token)
{
$result = Yii::$app->payPalRecurring->GetExpressCheckoutDetails($token);
$currentDate = new DateTime();
$subscription = new RecurringSubscription();
$subscription->PAYERID = $result['PAYERID'];
$subscription->AMT = SystemSetting::student_monthly_amount();
$subscription->BILLINGFREQUENCY = 1;
$subscription->BILLINGPERIOD = RecurringSubscription::MONTH;
@supostat
supostat / paypal_checkout.php
Created September 22, 2017 11:01
Paypal Checkout example
public function actionCheckout()
{
$request = Yii::$app->request->getBodyParams();
$params = [
'L_BILLINGAGREEMENTDESCRIPTION0' => '$' . SystemSetting::student_monthly_amount() . ' per month',
'cancelUrl' => \Yii::$app->params['payPalCallbackUrl'] . '/cancel',
'returnUrl' => \Yii::$app->params['payPalCallbackUrl'] . '/success'
];
if (isset($request['user_hash'])) {
$user = User::findOne(['hash' => $request['user_hash']]);
@supostat
supostat / pay_pal_requrring.php
Created September 22, 2017 10:59
PayPal Recurring example
<?php
namespace frontend\components\purrwebRecurring;
use common\models\User;
use Exception;
use Yii;
use yii\base\Component;
use linslin\yii2\curl;
use yii\helpers\ArrayHelper;
@supostat
supostat / MilestonesController.rb
Last active May 23, 2017 06:39
MilestonesController.rb
class Api::V1::MilestonesController < RequireAuthenticateController
include OwnerCheck
def index
offer = checked_offer(params[:offer_id])
render json: offer.milestones.order(created_at: :desc), status: :ok
end
def create
@offer = checked_offer(params[:offer_id])