Skip to content

Instantly share code, notes, and snippets.

View alxpsr's full-sized avatar

alxpsr alxpsr

  • Artsofte
  • 🇷🇺 Russia
View GitHub Profile
@alxpsr
alxpsr / curl_post_json.md
Created February 3, 2018 16:20 — forked from ungoldman/curl_post_json.md
post a file JSON file with curl

How do POST file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example:

constructor(private elementRef: ElementRef, private ngbPopover: NgbPopover,
private ngZone: NgZone, private cd: ChangeDetectorRef, private renderer: Renderer2) {
}
ngOnInit() {
this.ngZone.runOutsideAngular(() => {
this.listener = this.renderer.listen('document', 'click', (event) => {
this.closePopoverOnClickOutside(event);
});
});
@alxpsr
alxpsr / gist:eff00827d88b9e1bc817f9b132962a59
Created January 12, 2017 06:13 — forked from redoPop/gist:9050999cebcd7e50934a
IE10 & IE11 don't trigger touch events (e.g., touchstart). If you want to differentiate touches from clicks, you must use the pointer events API and the event object's pointerType property:
function onPointerDownHandler (event) {
if (event.pointerType === 'touch') {
// Equivalent to a touchstart on MS Surface
}
}
// For IE 10
element.addEventListener('MSPointerDown', onPointerDownHandler);
// For IE 11+
@alxpsr
alxpsr / shared-adaptive
Created July 13, 2016 08:08
shared-adaptive
$devices: tablet-landscape, tablet-portrait, tablet, phone, mobile, mobile-landscape, not-mobile !default;
$tablet-landscape: 1024px !default;
$tablet-portrait: 768px !default;
$phone: 480px !default;
@mixin device($device) {
//481...1024
@if $device == 'tablet' {
@media screen and (max-width: $tablet-landscape) and (min-width: $phone + 1) {
@content;
@alxpsr
alxpsr / special offfer
Created June 3, 2016 11:38
special offer
{{ car.SpecialOffer ? 'special-offer--' ~ car.specialOffer.type : '' }}
@alxpsr
alxpsr / no-css-sticky-footer
Created June 2, 2016 06:35
no-css-sticky-footer
@alxpsr
alxpsr / php_array
Created May 28, 2016 10:10
Подсчет элементов ассоциативного массива второго уровня вложенности
$test_array = array(
"person-1" => array(
"name" => "pete",
"lastname" => "rock",
"age" => "20"
),
"person-2" => array(
"name" => "jay",
"lastname" => "dee",
"age" => "40"
@alxpsr
alxpsr / if admin log in
Created May 26, 2016 13:08
body_addClass
{% set admin_panel_visible = (is_granted('manager_cars') or is_granted('manager') or is_granted('ROLE_SEO') or is_granted('ROLE_CONTENT')) %}
<body data-ng-app="front" data-ng-controller="common" {% if admin_panel_visible %}class="has_admin_panel" {% endif %}>
@alxpsr
alxpsr / call form
Created May 26, 2016 09:59
call form
<a href="#" class="footer-contacts__callback" data-lead-form {{ goal('new_callback') }} data-layer="{{ hostpath('landing_forms_layer', {'alias' :'new_callback'}) }}">Обратная связь</a>
@each $icon-name, $icon-pos-x in $icon-map-position-x {
&--#{$icon-name} {
background-position: $icon-pos-x 38px;
}
}