Skip to content

Instantly share code, notes, and snippets.

View hunk's full-sized avatar
🤑
working

Edgar G @hunk hunk

🤑
working
View GitHub Profile
from elasticsearch import Elasticsearch
es = Elasticsearch(ELASTICSEARCH_URL)
doc = {
'author': 'Patito',
'text': 'Some text here, more text.',
'timestamp': datetime.now(),
}
#!/bin/bash
set -x
awslocal s3api create-bucket --acl public-read --bucket patito-bucket
set +x
---
version: '3.7'
services:
localstack:
image: localstack/localstack
ports:
- 8080:8080
environment:
- SERVICES=s3,es
@hunk
hunk / multiline_field.js
Created September 4, 2016 19:30
field_types/multiline_field/multiline_field.js
jQuery.mf_bind('add',function(){
if('undefined' != typeof tinyMCEPreInit){
if ( typeof tinymce !== 'undefined' ) {
for ( id in tinyMCEPreInit.mceInit ) {
init = tinyMCEPreInit.mceInit[id];
$wrap = tinymce.$( '#wp-' + id + '-wrap' );
if ( $wrap.hasClass( 'html-active' ) ){
for ( id in tinyMCEPreInit.mceInit ) {
@hunk
hunk / multiline_field.js
Last active November 15, 2018 06:24
field_types/multiline_field/multiline_field.js
jQuery.mf_bind('add',function(){
if('undefined' != typeof tinyMCEPreInit){
// this is for relative_urls when the main editor is on text mode
if ( typeof tinymce !== 'undefined' ) {
for ( id in tinyMCEPreInit.mceInit ) {
init = tinyMCEPreInit.mceInit[id];
init.selector = "";
tinymce.init( init );
}
<html>
<script type="text/javascript">
window.addEventListener('load', function(){
document.body.addEventListener('touchstart', function(e){
var el = document.getElementById("outside");
el.innerHTML = "move in " + e.changedTouches[0].pageX;
}, false);
});
</script>
<style>
<?php
function callback_categories_function() {
global $post;
$categories = get_the_category();
$all = array();
foreach ($categories as $cat) {
$all[] = $cat->category_nicename;
}
@hunk
hunk / .htaccess
Created April 30, 2016 17:00
htaccess for MF 2.x
<FilesMatch "^(mf_upload)\.php$">
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</FilesMatch>
@hunk
hunk / .htaccess
Created April 30, 2016 17:00
htaccess for MF 1.X
<FilesMatch "(RCCWP_upload|RCCWP_GetDuplicate)\.php$">
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</FilesMatch>
@hunk
hunk / test.m
Created February 17, 2016 01:24
// Debug log \o/
HKNormal(@"normal log without color, but whit the format of HK");
HKVerbose(@"normal log with Verbose in gray");
HKDebug(@"this line is with a debug word in %@",@"blue");
HKInfo(@"a info log");
HKWarning(@"oh, no, oh no, this is not happening");
HKError(@"aahhhhh, help!!!!!!");
HKAlt(@"alternative color");
HKOpt(@"optional color");