Skip to content

Instantly share code, notes, and snippets.

View retran's full-sized avatar
:octocat:

Andrew Vasilyev retran

:octocat:
View GitHub Profile
#lang racket
(require plot)
(define (get-linear k)
(lambda (x) (+ x k)))
(define (get-square k)
(lambda (x) (* k (* x x))))
@retran
retran / sort.cs
Last active April 20, 2016 20:16
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace Sort
{
class Program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DoubleCheckingExample
{
class Cache
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DoubleCheckingExample
{
class Cache
function callcc(f, cc) {
f(function(x, k) {
cc(x);
}, cc);
}
function fuck(cc) {
console.log('first fuck');
cc(function(cc) {
console.log('second fuck');
Что должно вернуться из GET /api/customers если в системе нет ни одного кастомера?
1. null
2. []
3.
{
"customers": null
}
4.
{
@retran
retran / AttributesExample.cs
Created January 26, 2016 13:38
Naive attributes-based ACL example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AttributesExample
{
static class Configuration
{
(define (partial func . args)
(lambda a
(apply func (append args a))))
(define (sum a b) (+ a b))
(define add5 (partial sum 5))
(add5 10)
(defun throw-zigulka ()
(interactive)
(dolist (font-family (font-family-list))
(let ((str font-family))
(insert (propertize (concat "o/ o/ o/ o/ o/ o/ o/ o/ o/ o/ o/ o/ o/ o/ (" str ")")
'face `((:family ,font-family))))
(newline))))
@retran
retran / with.cs
Created September 24, 2015 11:57
using System;
using System.Collections.Generic;
using System.Linq;
namespace WithExample
{
static class IEnumerableExtension
{
public static IEnumerable<T> With<T>(this IEnumerable<T> collection, Func<IEnumerable<T>, IEnumerable<T>> proc)
{