Skip to content

Instantly share code, notes, and snippets.

View ephrin's full-sized avatar
🎯
Focusing

Volodymyr Myrza ephrin

🎯
Focusing
  • Vinnytsia/Ukraine
View GitHub Profile
@ggarcia24
ggarcia24 / pipeline.gdsl
Last active June 15, 2024 20:25
GDSL supporting pipeline declarative
//The global script scope
def ctx = context(scope: scriptScope())
//What things can be on the script scope
contributor(ctx) {
method(name: 'pipeline', type: 'Object', params: [body: Closure])
property(name: 'params', type: 'org.jenkinsci.plugins.workflow.cps.ParamsVariable')
property(name: 'env', type: 'org.jenkinsci.plugins.workflow.cps.EnvActionImpl.Binder')
property(name: 'currentBuild', type: 'org.jenkinsci.plugins.workflow.cps.RunWrapperBinder')
property(name: 'scm', type: 'org.jenkinsci.plugins.workflow.multibranch.SCMVar')
@bszwej
bszwej / echo.js
Last active July 23, 2024 19:51
Pure Node.js echo server, that logs all incoming http requests (method, path, headers, body).
const http = require('http');
const server = http.createServer();
server.on('request', (request, response) => {
let body = [];
request.on('data', (chunk) => {
body.push(chunk);
}).on('end', () => {
body = Buffer.concat(body).toString();
@telekosmos
telekosmos / dynamic-accessors.js
Created December 17, 2015 16:47
ES6 Dynamic accessors
describe('dynamic accessors', () => {
it('a dynamic getter name is enclosed in [ and ]', function() {
const balance = 'yourMoney';
class YourAccount {
get [balance]() { return -Infinity; }
}
assert.equal(new YourAccount().yourMoney, -Infinity);
});
@lox
lox / container-transform.go
Created November 25, 2015 05:39
Convert from docker-compose.yml to ecs task definition in golang
package transform
import (
"errors"
"fmt"
"strconv"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ecs"
@ephrin
ephrin / velocity_IDE_setter_fluid.vlc
Last active October 12, 2015 11:30
PHPStorm: Editor -> File and Code Templates: Code -> PHP Setter Method
/**
* @param ${TYPE_HINT} $${PARAM_NAME}
* @return static
*/
#set($th = $TYPE_HINT)
#set($ln = "|")
#set($be = "[]")
#set($aw = "array")
#set($c = ["int", "integer", "mixed", "str", "string", "bool", "boolean", "float", "double"])
@sphvn
sphvn / traverse.js
Last active October 26, 2023 21:49
Recursively traverse object javascript, recurse json js, loop and get key/value pair for JSON
var traverse = function(o, fn) {
for (var i in o) {
fn.apply(this,[i,o[i]]);
if (o[i] !== null && typeof(o[i])=="object") {
traverse(o[i], fn);
}
}
}
// usage
@steve-ng
steve-ng / nginx.conf
Last active May 28, 2024 08:27
Nginx reverse proxy wss with ssl
server {
listen 443 ssl;
server_name xxx.xx.io
ssl on;
ssl_certificate /etc/asterisk/certs/xxx.io.pem;
ssl_certificate_key /etc/asterisk/certs/xxx.io.key;
ssl_session_timeout 5m;
<?php
namespace Doctrine\ODM\MongoDB\Tests;
use Doctrine\Common\EventSubscriber;
use Doctrine\ODM\MongoDB\Events;
use Doctrine\ODM\MongoDB\Event\PreUpdateEventArgs;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
class SO23927996Test extends BaseTest
@mikaelbr
mikaelbr / destructuring.js
Last active April 25, 2024 13:21
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@ranacseruet
ranacseruet / VideoStream.php
Last active June 17, 2024 11:54
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";