Skip to content

Instantly share code, notes, and snippets.

View navix's full-sized avatar
❄️
Coding smart ;)

Oleksa Novyk navix

❄️
Coding smart ;)
View GitHub Profile
@renoirb
renoirb / composer.sls
Created August 28, 2013 16:27
Installing Composer using Salt Stack
get-composer:
cmd.run:
- name: 'CURL=`which curl`; $CURL -sS https://getcomposer.org/installer | php'
- unless: test -f /usr/local/bin/composer
- cwd: /root/
install-composer:
cmd.wait:
- name: mv /root/composer.phar /usr/local/bin/composer
- cwd: /root/
@macromaniac
macromaniac / XHR.ts
Last active November 3, 2019 23:19
simple typescript xhr using promises
module XHR {
export class Header {
header: string;
data: string;
constructor(header: string, data: string) {
this.header = header;
this.data = data;
}
}
@drewwiens
drewwiens / ng-dynamic-i18n.md
Last active April 14, 2022 20:14
(i18n) A simple way to dynamically load Angular translations

Problem

Calling loadTranslations() in either main.ts or in a resolved Promise does not work, at least in Angular 9 rc12. The function has to be called synchronously in polyfills.ts, so the translations also have to be available as a JS object, i.e. you can't fetch or XHR the JSON.

Solution

You could require() the JSON file in polyfills.ts, but then the JSON for all the languages will be in the bundle. (Try it and search for each JSON in polyfills.js.)

Alternatively, save each translation as a .js file and add a <script> tag to load only the desired translations.

#![feature(lang_items)]
#![no_std]
#[no_mangle]
pub fn add_one(x: i32) -> i32 {
x + 1
}
// needed for no_std
@tunguskha
tunguskha / Gradient shadow in pure CSS.md
Last active May 4, 2023 06:40
Gradient shadow in pure CSS

Gradient shadow in pure CSS

alt text

HTML
<button>Let's Go !</button>
@rantastic
rantastic / mail.php
Created April 16, 2012 22:17
PHP: Send email using amazon SES
<?php
//class docs: http://www.orderingdisorder.com/aws/ses/
require_once('ses.php');
//get credentials at http://aws.amazon.com My Account / Console > Security Credentials
$ses = new SimpleEmailService('ACCESSkeyID', 'SECRETaccessKEY');
$m = new SimpleEmailServiceMessage();
@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example

Angular Interview Questions

Some basic questions going from easy to difficult. A more exhaustive list of more questions from the community can be found here.

Easy

  • Whats the difference between components and directives? [ANSWER]: Components are widgets while directives more like decorators for elements and/or components.
  • How do you get a reference to a child component? [ANSWER]: ViewChild/ViewChildren or ContentChild/ContentChildren
  • What is the difference between ViewChild and ContentChild?
  • Whats the difference between NgModules and ES2015 Modules?
  • How do you lazy load components and why is lazy loading important?
  • Explain Observables and why they are useful.
@btroncone
btroncone / ngrxintro.md
Last active February 9, 2024 15:37
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@dankor
dankor / README.md
Last active April 2, 2024 14:30
Як отримувати гроші з Upwork через свого ФОПа

Як отримувати гроші з Upwork через свого ФОПа

Це коротка інструкція про те, як бути білим фрілансером. Почав писати для себе, бо не все знайшов в інтернеті. І вирішив, що це корисно всім, хто працює на біржі Upwork і хоче розібратися як легально там заробляти. Тут є офіційна стаття, яку я вирішив доповнити конкретним своїм прикладом.

Що для цього потрібно?

  • Мати відкритого фопа з відповідними кведами
  • Мати відкритий фопівський гривневий і доларовий рахунки

ФОП

Про відкриття фопа і його облікування не буду розписувати. Якщо у вас фопа немає, то краще звернутися до консалтингових компаній, які на цьому спеціалізуються. Єдине, на чому я хотів би зупинитися, це кведи. Бажано, щоб вони збігалися з послугами, які ви надаватимете. Наприклад, «Software Development» відповідає найкраще «62.01 Комп'ютерне програмування». Якщо у вас інші, то пошукайте те, чому найбільше відповідаєт