Skip to content

Instantly share code, notes, and snippets.

View aronbudinszky's full-sized avatar

Aron Budinszky aronbudinszky

View GitHub Profile
class MyProxyHttpOverride extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext context) {
return super.createHttpClient(context)
..findProxy = (uri) {
return "PROXY localhost:8888;";
}
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
}
@aronbudinszky
aronbudinszky / UIColor+HexHelper.swift
Last active March 22, 2018 22:18 — forked from anonymous/UIColor+Helper.swift
UIColor from Hex String in Swift
import UIKit
extension UIColor {
convenience init(hex: String, alpha: CGFloat = 1) {
assert(hex[hex.startIndex] == "#", "Expected hex string of format #RRGGBB")
let scanner = Scanner(string: hex)
scanner.scanLocation = 1 // skip #
var rgb: UInt32 = 0
<?php
....
function main(){
$this->zajlib->variable->my_posts = WpPost::fetch();
// Now let's filter the list by some type for example (the parameter is a regular WpQuery string, see: https://codex.wordpress.org/Class_Reference/WP_Query )
$this->zajlib->variable->my_posts->query([ 'cat' => 4 ]);
@aronbudinszky
aronbudinszky / keyvalue.html
Created October 12, 2016 15:04
Examples of using |keyvalue filter in Outlast Framework template system.
<!-- For arrays you can use the numeric key or associative key to reference a specific element -->
{{array|keyvalue:3}}
{{array|keyvalue:'array_key'}}
<!-- For any objects you can use the property name -->
{{user|keyvalue:'email'}} is the same as {{user.email}}
<!-- As always, you can chain filters -->
{{user|keyvalue:'data'|keyvalue:'email'}} is the same as {{user.data.email}}
@aronbudinszky
aronbudinszky / default.ctl.php
Last active August 24, 2016 11:39
Using formal languag variations in Outlast Framework.
<?php
// ...
public function __load(){
// Set langauge
$this->zajlib->lang->auto();
// Set my variation to formal (you must do this _before_ you load any language files)
$this->zajlib->lang->set_variation('formal');
// WARNING! This will only apply to this particular controller! See the site/index.php config setup for a site-wide change.
// Load my language file
$this->zajlib->lang->load('formfields');
@aronbudinszky
aronbudinszky / form.ctl.php
Last active July 27, 2016 06:14
Custom form validation.
<?php
//....
/**
* Custom validation logic.
* @param Form $form The form object that is currently being validated.
* @param array $data The array of form data sent.
* @return boolean Return false if you want to skip the plugin-level validation.
**/
public function __validate($form, $data){
<script>
requirejs(["system/js/ui/popup-campaign"], function(PopupCampaign){
// Create a popup campaign
var campaign = new PopupCampaign({
url: '/my/popupcampaign/show/', // The controller that displays the popup HTML (in ofw.alert)
selector: '#mypopup', // OR you can use this instead of url to simple removeClass('hide') on the popup campaign div
timeDelay: 25000, // 25 seconds delay before the popup is shown. You should use localStorage for the start time, so that the timer is preserved across page views.
cookieName: 'popupcampaign', // Optional, defaults to 'popupcampaign' - The name of the cookie (or localstorage key?) that stores the number of times this user has seen this item. Only needed if you have several per page.
cookieExpiryDays: 90, // Optional, defaults to 90 - The number of days after which the cookie / localstorage expires.
<div class="row">
<div class="col-md-12">
<!-- Will display only the first column. -->
{% contentpagesections 1 %}
</div>
</div>
<div class="row">
<div class="col-md-6">
<!-- Will display only the second column's first section. -->
{% contentpagesections 2 1 %}
<div class="row">
<div class="col-md-8">
<!-- Will display only the first column. -->
{% contentpagesections 1 %}
</div>
<div class="col-md-4">
<!-- Will display only the second column. -->
{% contentpagesections 2 %}
</div>
</div>
@aronbudinszky
aronbudinszky / _textarea.html
Created June 8, 2016 17:47
Example without system field.
<input type="text" name="{{content.contentpagesection.nameprefix|add:'[textcontent]'}}" value="{{content.contentpagesection.data.textcontent|escape}}">