Skip to content

Instantly share code, notes, and snippets.

View rainb3rry's full-sized avatar
💃

rainb3rry

💃
  • Istanbul
View GitHub Profile
@Biostate
Biostate / iller.js
Created December 8, 2017 18:39
Türkiye iller ve ilçeleri Array
var iller = {
"Ankara": ["Altındağ", "Ayaş", "Bala", "Beypazarı", "Çamlıdere", "Çankaya", "Çubuk", "Etimesgut", "Haymana", "Kalecik", "Keçiören", "Kızılcahamam", "Mamak", "Nallıhan", "Polatlı", "Şereflikoçhisar", "Sincan", "Yenimahalle"],
"İstanbul": ["Adalar", "Bağcılar", "Bahçelievler", "Bakırköy", "Beşiktaş", "Beykoz", "Beyoğlu", "Büyükçekmece", "Çatalca", "Eminönü", "Esenler", "Eyüp", "Fatih", "Gaziosmanpaşa", "Güngören", "Kadıköy", "Kağıthane", "Kartal", "Küçükçekmece", "Maltepe", "Pendik", "Sarıyer", "Silivri", "Şile", "Şişli", "Sultanbeyli", "Tuzla", "Ümraniye", "Üsküdar", "Zeytinburnu"],
"İzmir": ["Aliağa", "Balçova", "Bayındır", "Bergama", "Beydağ", "Bornova", "Buca", "Çeşme", "Dikili", "Foça", "Güzelbahçe", "Karaburun", "Karşıyaka", "Kemalpaşa", "Kınık", "Kiraz", "Konak", "Menderes", "Menemen", "Narlıdere", "Ödemiş", "Seferihisar", "Selçuk", "Tire", "Torbalı", "Urla"],
"Adana": ["Aladağ", "Ceyhan", "Feke", "Karaisalı", "Kozan", "Pozantı", "Saimbeyli", "Seyhan", "Yumurtalı", "Yüreğir"
@lolindirfaelivrin
lolindirfaelivrin / php_perumtaion.php
Created May 3, 2012 08:50
PHP: Php string permutation
<?php
/**
* Permutations
*
* Returns an array of strings containing all the
* ($alphabet ^ $output_length) permutations
*
* @alphabet (string|array) set of at least two elements to choose from
* @output_length (int) the number of elements in each output string
*
@woudsma
woudsma / async-trycatch.js
Last active November 27, 2020 22:37
Recursive try/catch statements for async/await functions in a nested object (using .catch)
// Simulates try/catch statements wrapping async functions in (nested) object
// Returns copy of original object with basic promise-rejection handling for async functions using .catch
// Saves the time of writing try/catch statements in every single async function
const trycatch = obj => Object.keys(obj)
.reduce((acc, curr) => ({ ...acc, [curr]: obj[curr] instanceof Function
? (...args) => obj[curr](...args).catch(::console.error)
: trycatch(obj[curr]) }), {})
@dtbaker
dtbaker / class.envato-api-basic.php
Last active December 21, 2020 06:15
Simple PHP class for interacting with the Envato API within a WordPress plugin
<?php
/**
* Exception handling class.
*/
class EnvatoException extends Exception {
}
@rcmachado
rcmachado / jquery.unserialize.js
Created November 25, 2009 10:19
$.unserialize for jQuery
/**
* $.unserialize
*
* Takes a string in format "param1=value1&param2=value2" and returns an object { param1: 'value1', param2: 'value2' }. If the "param1" ends with "[]" the param is treated as an array.
*
* Example:
*
* Input: param1=value1&param2=value2
* Return: { param1 : value1, param2: value2 }
*
@awestmoreland
awestmoreland / sass-var-concat.scss
Last active July 19, 2021 19:47
Concatenation of sass value+units. See also: http://stackoverflow.com/a/9862328
// Set sizes without units
$basefont: 20;
$total-width-px: 1169;
$column-width-px: 72;
// Concatenation of units by addition results in conversion to string. This is bad
$basefont-px: $basefont+'px'; // = "20px"
// Conversion to pixels using multiplication
$basefont-px: $basefont*1px; // = 20px;
@brasofilo
brasofilo / download.php
Created June 3, 2012 12:55
Force File Download with PHP
<?php
/*
* Foce File Download
* Usage: http://example.com/download.php?file=./uploads/image.jpg
*
* There are a couple of *ninja* exit() as security guarantee, adapt as necessary
*
*/
// grab the requested file's name
@HassenIO
HassenIO / sha256.sh
Last active January 21, 2022 10:27
Get SHA256 of a text in Mac OSX terminal
# Get SHA256 of a text
# Usage: sha256 password
# output: 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
function sha256() {
echo -n $1 | shasum -a 256
# Source: http://albertech.blogspot.fr/2015/02/generate-sha-256-hash-from-command-line.html
}
@evenchange4
evenchange4 / step.md
Created September 23, 2012 21:55
Deploy a Express.js project on Heroku

Deploy a Express.js project on Heroku

Step by step from command line by Michael Hsu

Quick start

Create a Node.js web framework 'express'

$ express myfirstexpress && cd myfirstexpress

Declare dependencies with NPM /package.json

@toshimaru
toshimaru / jquery-scroll-bottom.js
Last active May 31, 2022 10:55
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});