This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If you want inserted images in a CKEditor to be responsive | |
// you can use the following code. It creates a htmlfilter for the | |
// image tag that replaces inline "width" and "style" definitions with | |
// their corresponding attributes and add's (in this example) the | |
// Bootstrap "img-responsive" class. | |
CKEDITOR.on('instanceReady', function (ev) { | |
ev.editor.dataProcessor.htmlFilter.addRules( { | |
elements : { | |
img: function( el ) { | |
// Add bootstrap "img-responsive" class to each inserted image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function convertCronJobScheduleToHumanReadable($schedule) { | |
// Split the schedule into its components. | |
$components = explode(' ', $schedule); | |
// Get the minute, hour, day of month, month, day of week, and year components. | |
$minute = $components[1] ?? '*'; | |
$hour = $components[2] ?? '*'; | |
$dayOfMonth = $components[3] ?? '*'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set the client ID and secret | |
$client_id = "YOUR_CLIENT_ID"; | |
$client_secret = "YOUR_CLIENT_SECRET"; | |
// Set the scope for email and drive | |
$scope = | |
"https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/drive"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL & ~E_NOTICE); | |
class cPanelLicensing { | |
function __construct ($user, $pass, $key = NULL) { | |
if (!function_exists('curl_init')) { | |
die("cPanelLicensing requires that curl+ssl support is compiled into the PHP interpreter\n"); | |
} | |
$this->set_format("simplexml"); | |
$this->curl = curl_init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Psr\Log\LoggerInterface; | |
interface ClientInterface | |
{ | |
/** | |
* Constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use phpseclib\Net\SSH2; | |
class ZimbraAccountManager { | |
private $sshHost = "zimbra.example.com"; | |
private $sshUser = "root"; | |
private $sshPassword = "rootpassword"; | |
public function createAccount($email, $password) { | |
$command = "zmprov ca $email $password"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImageMerger { | |
private $og_image; | |
private $site_banner; | |
private $output_name; | |
private $output_path; | |
public function __construct($og_image, $site_banner, $output_name, $output_path) { | |
$this->og_image = $og_image; | |
$this->site_banner = $site_banner; | |
$this->output_name = $output_name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class AdvancedTextFormField extends StatelessWidget { | |
final String labelText; | |
final String hintText; | |
final String initialValue; | |
final bool obscureText; | |
final TextInputType keyboardType; | |
final TextCapitalization textCapitalization; | |
final List<TextInputFormatter> inputFormatters; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData( |