Skip to content

Instantly share code, notes, and snippets.

View RinatMullayanov's full-sized avatar

Rinat Mullayanov RinatMullayanov

View GitHub Profile
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active April 2, 2024 20:18
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@satyrius
satyrius / exercise-36.go
Created October 23, 2013 06:18
A Tour of Go. Exercise: Slices. Implement Pic. It should return a slice of length dy, each element of which is a slice of dx 8-bit unsigned integers. When you run the program, it will display your picture, interpreting the integers as grayscale (well, bluescale) values. The choice of image is up to you. Interesting functions include x^y, (x+y)/2…
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
res := make([][]uint8, dy)
for y := range res {
res[y] = make([]uint8, dx)
for x := range res[y] {
res[y][x] = uint8((x + y) /2)
@phungnc
phungnc / provider, factory, service source code in Angular.js
Created December 6, 2013 08:15
the difference between service, factory, provider in angular.js
// Below is the source code pick from angular.js
// Read source code help us more clearer
// the difference between service, factory, provider
function provider(name, provider_) {
if (isFunction(provider_) || isArray(provider_)) {
provider_ = providerInjector.instantiate(provider_);
}
if (!provider_.$get) {
throw Error('Provider ' + name + ' must define $get factory method.');
}
@RinatMullayanov
RinatMullayanov / sample_inheritance.js
Last active August 29, 2015 14:01
Наследование(inheritance) на основе метода предложенного Дугласом Крокфордом
// http://javascript.crockford.com/prototypal.html
// базовый вариант наследования предложенный Дугласом Крокфордом
function object(o) {
function F() {}
F.prototype = o;
return new F();
}
// ECMASсript 3
// продвинутый вариант того что предложил Дуглас Крокфорд
@staltz
staltz / introrx.md
Last active May 7, 2024 09:38
The introduction to Reactive Programming you've been missing
@RinatMullayanov
RinatMullayanov / modern_inheritance.js
Created August 28, 2014 08:32
Sample modern prototype inheritance in Javacript
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call
function Product(name, price) {
this.name = name;
this.price = price;
if (price < 0)
throw RangeError('Cannot create product ' +
name + ' with a negative price');
return this;
}
@patrickarlt
patrickarlt / build.sh
Last active March 25, 2020 04:42
ES 7 async/await demo!
babel github-es6.js -o github.js --optional runtime --experimental
var Circle = function() {};
Circle.prototype = {
area: function() {
return Math.PI * this.radius * this.radius;
},
grow: function() {
this.radius++;
},
shrink: function() {
this.radius--;
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@RinatMullayanov
RinatMullayanov / bem-naming.css
Last active August 29, 2015 14:19
BEM naming in CSS and HTML
.some-block {} /*block*/
.some-block__element {} /*element*/
.some-block_size_large {} /*modificator of block*/
.some-block__element_size_large {} /*modificator of element*/
/*
Block may contains another blocks and elements.
Element may contains another blocks and elements.
*/