Skip to content

Instantly share code, notes, and snippets.

View Balamir's full-sized avatar

Abdullah M. Ceylan Balamir

View GitHub Profile
dbcc shrinkfile ('dbname_log',1)
Array.prototype.toIterator = function*() {
for (var i = 0, l = this.length; i < l; i++) {
yield this[i]
}
}
Object.prototype.map = function*(lambda) {
for (var value of this) {
yield lambda(value)
}
@Balamir
Balamir / treehouse.sh
Last active August 29, 2015 14:06 — forked from yitsushi/treehouse.sh
#!/usr/bin/env sh
# If DEBUG environment variable is not defined set as false
if [[ "x${DEBUG}" == "x" ]]
then
DEBUG=false
fi
# Logger function. Display a message if DEBUG is true
logMessage() {
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
<!-- country codes (ISO 3166) and Dial codes. -->
<select name="countryCode" id="">
<option data-countryCode="GB" value="44" Selected>UK (+44)</option>
<option data-countryCode="US" value="1">USA (+1)</option>
<optgroup label="Other countries">
<option data-countryCode="DZ" value="213">Algeria (+213)</option>
<option data-countryCode="AD" value="376">Andorra (+376)</option>
<option data-countryCode="AO" value="244">Angola (+244)</option>
<option data-countryCode="AI" value="1264">Anguilla (+1264)</option>
<option data-countryCode="AG" value="1268">Antigua &amp; Barbuda (+1268)</option>
@Balamir
Balamir / turkish_country_list.php
Last active March 25, 2024 22:17
Ülke kodları ile birlikte Türkçe isimlendirilmiş ülke listesi - PHP Array
<?php
$countries_name_first = array(
'Türkiye' => 'TR',
'ABD Virgin Adaları' => 'VI',
'Afganistan' => 'AF',
'Aland Adaları' => 'AX',
'Almanya' => 'DE',
'Amerika Birleşik Devletleri' => 'US',
'Amerika Birleşik Devletleri Küçük Dış Adaları' => 'UM',
@Balamir
Balamir / is_serialized.php
Created February 12, 2016 17:13
PHP is_serialized()
<?php
/**
* From Wordpress
* Check value to find if it was serialized.
*
* If $data is not an string, then returned value will always be false.
* Serialized data is always a string.
*
* @since 2.0.5
@Balamir
Balamir / Material More Button CSS.markdown
Created February 15, 2016 14:13
Material More Button CSS

Material More Button CSS

More Info button with material design style. Let me know if you've seen something like this. Used input:checked and a checkbox to build this, then used a tags to protect the click from unchecking the checkbox.

Forked from Alex Coven's Pen Material More Button CSS.

A Pen by Abdullah Ceylan on CodePen.

License.

@Balamir
Balamir / foreach_after_nth_record.php
Last active February 17, 2016 11:38
PHP foreach - Close and reopen the 'tr' tag after nth record
<?php
$i = 0;
echo '<tr>';
foreach ($variable as $key => $value) {
$i++;
'<td>' . $key . '</td>' .
'<td>' . $value . '</td>';
// Close and reopen the 'tr' tag after fourth record
@Balamir
Balamir / convert_array2object_object2_array.php
Created February 20, 2016 12:14
PHP stdClass Object to Array and Array to stdClass Object
<?php
/**
* Array veriyi Object'e donusturur
*
* Belirtilen array veriyi, tum alt array'lerle birlikte
* object'e donusturerek cikti verir
*
* @since 2.0
*
* @param array $array_data Object'e donusturulecek array veri