Skip to content

Instantly share code, notes, and snippets.

@Balamir
Balamir / itunes_connect_bulk_delete_inapp_purchase_products.js
Last active March 7, 2016 11:39
Bulk delete in-app purchase products on iTunes Connect
$('.pane-layout-content-header #textDiv').append($('<li id="del-script">').append($('<a class="js-nav">"').text('...')));
$('.itc-checkbox').parent().removeClass('ng-hide');
window.delscrpt = setInterval(function() {
$('.itc-checkbox input:checked').parents('tr').find('a.deleteIcon').each(function(){ $(this).click(); return false;});
var count = $('.itc-checkbox input:checked').parents('tr').find('a.deleteIcon').length;
if (count < 3) {
$('#del-script a').text('Del Done.');
clearInterval(window.delscrpt);
return;
@Balamir
Balamir / st_key_bindings.json
Last active February 26, 2016 13:42
Sublime Text key bindings
[
{ "keys": ["ctrl+2"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+2"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["ctrl+k", "ctrl+,"], "command": "fold_by_level", "args": {"level": 10} },
/* Auto-pair underscores */
{ "keys": ["_"], "command": "insert_snippet", "args": {"contents": "_$0_"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
@Balamir
Balamir / st_preferences.json
Created February 26, 2016 13:38
Sublime Text preferences
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_extra_width": 1,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/User/SublimeLinter/Dark-Material (SL).tmTheme",
"draw_minimap_border": true,
"extract_sublime_package_ask_on_open": true,
"fallback_encoding": "UTF-8",
@Balamir
Balamir / serialize_unserialize.php
Created March 20, 2016 20:34
Prevent PHP serialize & unserialize errors
<?php
//to safely serialize
$safe_string_to_store = base64_encode(serialize($multidimensional_array));
//to unserialize...
$array_restored_from_db = unserialize(base64_decode($encoded_serialized_string));
//That's it!
@Balamir
Balamir / in_array_case_insensitive.php
Created May 25, 2016 08:51
Case insensitive PHP in_array function
<?php
/**
* PHP'nin in_array fonksiyonunun buyuk-kucuk harf duyarsiz hali
*
* @since 2.0
*
* @param string $needle Array icinde aranacak olan deger (igne)
* @param array $haystack Arama yapilacak array (samanlik)
* @return bool
@Balamir
Balamir / gist:3e7e9f8fe3561e112d1c8f181a3d800f
Created May 25, 2016 15:00
Posting Slack message on Google Docs spreadsheet cell update
/**
* @author Chris Tate-Davies
* @web http://blog.tatedavies.com/2016/05/10/posting-slack-message-on-google-docs-spreadsheet-cell-update/
* @revision 0.0.1
*
* 10th May 2016
* Purpose - send a slack payload to bot-database informing users of database update requirements
**/
function ceta_db_column_edit(event){
@Balamir
Balamir / pluralize.php
Created June 3, 2016 13:15
English word plurization
<?php
/*
original : http://stackoverflow.com/a/34254595
*/
function getPluralPrase( $phrase, $value ) {
$plural='';
if( $value > 1 ) {
for( $i = 0; $i < strlen( $phrase ); $i++ ) {
@Balamir
Balamir / example-custom-wrapper.js
Created June 14, 2016 13:48
jQuery-backward-timer - Custom wrappers
/* https://github.com/Balamir/jQuery-backward-timer/tree/balamir */
$('#timer-custom-w-wrapper').backward_timer({
seconds: 45296,
use_wrapper: true,
wrappers: {
hours: '.hours_dash .digit',
minutes: '.minutes_dash .digit',
seconds: '.seconds_dash .digit'
}
@Balamir
Balamir / wp-query-ref.php
Created June 15, 2016 09:23 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@Balamir
Balamir / wordpress-search-query.php
Created June 15, 2016 10:20
Wordpress - Search Query
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : ((get_query_var('page')) ? get_query_var('page') : 1);
$search = array(
'post_type' => 'properties',
'post_status' => 'publish',
'orderby' => $date_order,
'order' => $order,
'pagination' => true,
'posts_per_page' => 10,