Skip to content

Instantly share code, notes, and snippets.

View kartagis's full-sized avatar

Tolga Ozses kartagis

View GitHub Profile
@kartagis
kartagis / auth.py
Created December 16, 2015 17:48 — forked from ibeex/auth.py
Python LDAP (ActiveDirectory) authentication
import ldap
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
# Adapt to your needs
"""
LDAP_SERVER = 'ldap://xxx'
# fully qualified AD user name
LDAP_USERNAME = '%[email protected]' % username
@kartagis
kartagis / PDO_mysql.connect.php
Created August 23, 2016 16:14 — forked from adrian-enspired/PDO_mysql.connect.php
how to make a new mysql connection with PDO.
<?php
$host = "db hostname";
$dbname = "db name";
$user = "db username";
$pass = "db password";
$charset = "UTF8MB4"; // if your db does not use CHARSET=UTF8MB4, you should probably be fixing that
$dsn = "mysql:host={$host};dbname={$dbname};charset={$charset}";
@kartagis
kartagis / cordovacheatsheet.md
Created September 5, 2016 06:55 — forked from nazrdogan/cordovacheatsheet.md
Cordova CheatSheet

##npm komutları

npm install -g cordova

node.js kullanarak cordova'yı bilgisayarınıza yükler.

##cordova komutları

cordova create hello com.example.hello HelloWorld

@kartagis
kartagis / gist:3f35ff8f5422c39e8c5b787274f6ff9f
Created December 23, 2016 07:04 — forked from chrissimpkins/gist:5bf5686bae86b8129bee
Atom Editor Cheat Sheet (Sweetmeat)

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@kartagis
kartagis / README.md
Created February 16, 2017 06:31 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@kartagis
kartagis / mysql_countries.sql
Created May 26, 2017 06:11 — forked from kamermans/mysql_countries.sql
MySQL Dump - continents and countries with 2 and 3 char codes, names and full names - Braintree compatible as of Dec 2011
/**
* Continents and Countries MySQL Tables compiled from Wikipedia, Braintree Payments documentation
* and a couple other places I don't recall at the moment. This data is compatible with the Braintree
* Payment API as of Dec 2011
*
* Compiled by Steve Kamerman, 2011
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
<?php
namespace Drupal\mitacan\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
class MitacanUploadForm extends FormBase {
public function buildForm(array $form, FormStateInterface $form_state) {
$form['csv_upload'] = [
vagrant@drupalvm:/var/www/drupalvm/drupal/web/sites$ apache2 -t
[Tue Dec 04 06:05:44.695289 2018] [core:warn] [pid 12410] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Tue Dec 04 06:05:44.695870 2018] [core:warn] [pid 12410] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Tue Dec 04 06:05:44.696349 2018] [core:warn] [pid 12410] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Tue Dec 04 06:05:44.696636 2018] [core:warn] [pid 12410] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Tue Dec 04 06:05:44.697012 2018] [core:warn] [pid 12410] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Tue Dec 04 06:05:44.712536 2018] [core:warn] [pid 12410:tid 139739474769792] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class BlogController extends Controller
{
/**
* Display a listing of the resource.
@kartagis
kartagis / MyCustomForm.php
Created May 29, 2023 14:41 — forked from MatthieuScarset/MyCustomForm.php
Drupal - Autosubmit exposed form in JS
<?php
namespace Drupal\mymodule\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a custom form.
*/