Skip to content

Instantly share code, notes, and snippets.

View m-pokrovskii's full-sized avatar

Maxim Pokrovskii m-pokrovskii

View GitHub Profile
service.notifications
  .create({
        toBinding: bindings,
        body: message,
sms: {
status_callback: 'https://peppernet.serveo.net/admin/twilio/status/1'
}
  })
  .then((notification) => {
        console.log('Notify: ', notification.sid);
function generateUsername(username){
let u = Meteor.users.findOne({ username });
let n=0;
let uname=username;
while(u){
n++;
uname = username+n;
u = Meteor.users.findOne({ username:uname });
}
return uname;
@m-pokrovskii
m-pokrovskii / sample.json
Created June 1, 2016 04:49
odoo sample products
{
"_id" : "6YvWEPbxzcNzjKEag",
"incoming_qty" : 0,
"standard_price" : 12.41,
"write_uid" : [
5,
"Malik"
],
"display_name" : "ZYRTEC DROPS 10ML",
"item_ids" : [ ],
product: {
id: 1,
title: "ProductTitle",
supplierID: 1,
_last_change: "29.29.16"
}
supplier: {
id: 1,
title: "SupplierTItle",
@m-pokrovskii
m-pokrovskii / new_gist_file.php
Created June 8, 2015 06:25
Get all images id from post_content.
function insertedImage_save_meta($post_id) {
$upPost = get_post($post_id);
$rawPostDoc = new DOMDocument();
@$rawPostDoc->loadHTML($upPost->post_content);
$imgs = $rawPostDoc->getElementsByTagName('img');
foreach($imgs as $img){
$imgIDStr = substr($img->getAttribute('class'), (stripos($img->getAttribute('class'),'wp-image-')+9), 8);
$imgID = preg_replace("[^0-9]", '', $imgIDStr);
@m-pokrovskii
m-pokrovskii / new_gist_file.php
Created June 7, 2015 08:06
Get all images from post
<ul>
<?php
$doc = new DOMDocument();
@$doc->loadHTML($post->post_content);
$tags = $doc->getElementsByTagName('img');
foreach ($tags as $tag) {
echo '<li>'.$tag->getAttribute('src').'</li>';
}
?>
@m-pokrovskii
m-pokrovskii / new_gist_file.js
Created May 5, 2015 15:36
Get fractional value (104.222px)
// get fractional value (104.222px)
Element.getBoundingClientRect();
<style>
.videoWrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.videoWrapper iframe {
position: absolute;
top: 0;
@m-pokrovskii
m-pokrovskii / gist:8f86e47507a5686ec261
Created April 15, 2015 11:53
Beauty numbers #snippet #js
var n = 123456;
n.toLocaleString;
// 123,456
@m-pokrovskii
m-pokrovskii / css_resources.md
Created July 7, 2014 17:20 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides