Skip to content

Instantly share code, notes, and snippets.

View briedis's full-sized avatar
🪵

Mārtiņš Briedis briedis

🪵
View GitHub Profile
@briedis
briedis / index.php
Created December 18, 2013 15:30
Komanda Acually is dolan
<?
function fibonacci($n, $first = 0, $second = 1){
$fib = [$first, $second];
for($i = 1; $i < $n; $i++){
$fib[] = $fib[$i] + $fib[$i - 1];
}
return $fib;
}
@briedis
briedis / mke.js
Created November 4, 2014 15:54
examples
\// veidojam vnk nodi, piemēram, div
mkE( {
tag:'div'
} );
// node ar tekstu, to nevajag eskeipot
mkE( {
tag:'div',
text:'Hello world!'
} );
<?
private function _processMessage($messageBody){
$re = new Returned__item;
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$body = \Mail_Mimedecode::decode([
'include_bodies' => true,
'decode_bodies' => true,
'decode_headers' => true,
'input' => $messageBody
<?php
$userNames = str_split('QWERTYUIJPABCDE');
$forbidden = [
'Q' => 'W',
'P' => 'A',
'U' => 'I',
'D' => 'E',
];
$generateSet = function() use ($userNames){
<?php
$userNames = str_split('QWERTYUIJPABCDE');
$forbidden = [
'Q' => 'W',
'P' => 'A',
'U' => 'I',
'D' => 'E',
];
$generateSet = function () use ($userNames){
$url = 'https://www.googleapis.com/drive/v2/files/' . urlencode($_POST['googleFileId']) . '?alt=media';
$oAuthToken = $_POST['oAuthToken'];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
@briedis
briedis / code-review.md
Created September 19, 2016 13:32
Code review checklist

General

  • Is branch up-to date with master branch?
  • Is auto-format performed? (on new code/edited code block (function, etc) Should avoid messing git history with auto-formatting!)
  • Are all IDE errors fixed (green check mark in corner)?
  • Are variable names self-describing?
  • Are function names self-describing?
  • Are boolean function/variable names prefixed with is, has, can, should, etc.?
  • Is function line count too much, can something be split up?
  • Is file line count too much (>400), can something be split up?
@briedis
briedis / creating-components.js
Created September 23, 2016 13:01
Todo list example with Class and mkE
(function () {
'use strict';
// Lets create a simple checklist component, which can add items to the list, allow user to toggle check state,
// remove items, and display summary to the user
// Screen-shot: http://i.imgur.com/2ilIB6h.png
/* -------------- Main component -------------- */
var TodoList = Class({
(function () {
'use strict';
function something() {
alert(counter);
}
var myObject = new function(){
this.data = {
counter: 0
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">