Skip to content

Instantly share code, notes, and snippets.

View cergey-obr's full-sized avatar

Sergey Obraztsov cergey-obr

View GitHub Profile
@aquiseb
aquiseb / graphql-go-mongodb-example.go
Last active August 7, 2022 23:39
Minimal example of GraphQL Golang and MongoDB playing nicely together. Edit
// Embedded in this article https://medium.com/p/c98e491015b6
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/graph-gophers/graphql-go"
@ygotthilf
ygotthilf / jwtRS256.sh
Last active July 25, 2024 11:09
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@cergey-obr
cergey-obr / isCorrectCaptcha.js
Last active February 19, 2016 05:35
Проверка капчи через ajax
$.validator.addMethod('isCorrectCaptcha', function(value, element, params){
var is_valid = false;
$.ajax({
url: '/udata/custom/isCorrectCaptcha/',
type: 'POST',
async: false,
data: {
captcha: value
},
success: function(xml){
@cergey-obr
cergey-obr / guide.xml
Created July 23, 2014 12:16
Usel для получение значений справочника в xslt
<?xml version="1.0" encoding="utf-8"?>
<selection>
<target result="objects">
<type id="{1}" />
</target>
<limit page="{3}">{2}</limit>
</selection>
@glebcha
glebcha / gulpfile.js
Last active September 14, 2022 08:39
Gulp task sample (css and js minify+concat, compress images, watching for changes)
// Определяем зависимости в переменных
var gulp = require('gulp'),
cache = require('gulp-cache'),
clean = require('gulp-clean'),
stream = require('event-stream'),
size = require('gulp-size'),
jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
minifyCSS = require('gulp-minify-css'),
@damiann
damiann / send_email
Last active October 12, 2020 16:48
Send Magento template email with attachment.
<?
// using model magento\app\code\core\Mage\Core\Model\Email\Template.php
public function send_error_email($error = NULL) {
$mailTemplate = Mage::getModel('core/email_template');
$mailTemplate->setSenderName('Insert Sender Name'); // use general Mage::getStoreConfig('trans_email/ident_general/name');
$mailTemplate->setSenderEmail('insert@sender.email'); // use general Mage::getStoreConfig('trans_email/ident_general/email')
$mailTemplate->setTemplateSubject('Insert Subject Title');
$mailTemplate->setTemplateText('Insert Body Text');
@megawubs
megawubs / gist:4433753
Last active April 18, 2017 05:27 — forked from davidalexander/gist:1086455
Magento snippets

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@searbe
searbe / parse_xlsx.php
Created August 7, 2012 09:48
Parse simple XLSX in PHP with SimpleXML and ZipArchive
<?php
/**
* I had to parse an XLSX spreadsheet (which should damn well have been a CSV!)
* but the usual tools were hitting the memory limit pretty quick. I found that
* manually parsing the XML worked pretty well. Note that this, most likely,
* won't work if cells contain anything more than text or a number (so formulas,
* graphs, etc ..., I don't know what'd happen).
*/