Skip to content

Instantly share code, notes, and snippets.

View beratdogan's full-sized avatar

Berat Doğan beratdogan

View GitHub Profile
@beratdogan
beratdogan / Ticket.php
Last active December 31, 2015 19:49
Laravel Denetim (Validation) Sınıfını AJAX ile Kullanmak
<?php
class Ticket extends Eloquent {
protected $guarded = array();
protected $table = 'tickets';
protected $softDelete = true;
public function messages()
@beratdogan
beratdogan / run.js
Created December 25, 2013 22:25
Sometimes you'll need jQuery on non-JS pages. In such a situation, you can include jQuery with this code.
jq = document.createElement('script');
jq.type = "text/javascript";
jq.src = 'http://code.jquery.com/jquery-1.10.2.min.js';
document.body.appendChild(jq);
// try: jQuery and have fun!
@beratdogan
beratdogan / domdocument.php
Created December 27, 2013 20:32
PHP DOMDocument Sınıfının Desteklenmeyen Etiketlerde Hata Vermesinin Engellenmesi
<?php
$dom = new DOMDocument;
$previousValue = libxml_use_internal_errors(true);
$dom->loadHTML('...');
libxml_clear_errors();
libxml_use_internal_errors($previousValue);
@beratdogan
beratdogan / DisposableClassException.php
Created February 3, 2014 20:34
Defining dispoasble classes with Traits in PHP.
<?php
class DisposableClassException extends \Exception
{}
@beratdogan
beratdogan / turkey_provinces_districts.json
Last active August 29, 2015 13:56
A huge list of provinces and their districts of Turkey in JSON format. Have fun!
[
{
"name":"Adana",
"slug":"adana",
"plate_code":1,
"districts":[
{
"name":"Alada\u011f",
"slug":"aladag"
},
@beratdogan
beratdogan / App.config.xml
Last active August 29, 2015 13:56
Blog Post: .Net2.0 Uygulamalarinin .Net4.0'da Calismamasi
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0.30319" />
</startup>
</configuration>
@beratdogan
beratdogan / TempFileClass.cs
Created March 15, 2014 11:33
C#'ta Exe icine Gomulmus Baska Bir Exe'yi Calistirmak
sealed class TempFile : IDisposable
{
string path;
public TempFile() : this(System.IO.Path.GetTempFileName()) { }
public TempFile(string path)
{
if (string.IsNullOrEmpty(path)) throw new ArgumentNullException("path");
this.path = path;
}
@beratdogan
beratdogan / coffee_watcher.sh
Created April 13, 2014 00:53
Appends seperated .coffee files into one file, and compiles as application.js. So cool, hah?
#!/bin/sh
clear
echo "CoffeeScript watching you!"
coffee -j js/application.js -wc js/
@beratdogan
beratdogan / array_fill
Created April 22, 2014 23:07
Fill arrays in JavaScript.
Array.apply(null, new Array(3)).map(Array.prototype.valueOf, (Array.apply(null, new Array(3)).map(Number.prototype.valueOf, 0)));
@beratdogan
beratdogan / 1_scope.js
Last active August 29, 2015 14:00
[JavaScript][CoffeeScript] Degisken/Fonksiyon Etki Alanlari
$('#menu a').click(function(event)
{
// $(this)
// Bize '#menu a'ya ait tiklanmis olan elementi gosterecektir.
$('#menu li').each(function(index)
{
// $(this)
// Bize '#menu li'ye ait elementleri isaret edecektir.
});