Skip to content

Instantly share code, notes, and snippets.

View kublaios's full-sized avatar

Kubilay Erdogan kublaios

View GitHub Profile
@kublaios
kublaios / gist:4d32b18e54f2c9b679f2
Created June 25, 2014 20:53
Sublime SFTP Sample sftp-config.json File (Non-Secure & Secure)
{
// The tab key will cycle through the settings when first created
// Visit http://wbond.net/sublime_packages/sftp/settings for help
// sftp, ftp or ftps
"type": "ftp", // set to sftp if secure
"save_before_upload": true,
"upload_on_save": true,
"sync_down_on_open": false,
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
@kublaios
kublaios / .gitignore
Created June 26, 2014 06:50
Sample .gitignore for Xcode 4 & 5 Projects
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
*.DS_Store
*.lock
*.mode1v3
*.mode2v3
*.moved-aside
*.o
@kublaios
kublaios / gist:f01cdf4369c86ddd6d71
Created June 27, 2014 06:46
Making a PEM File for iOS Push Notifications (From Ray Wenderlich's tutorial)
# Convert the .cer file into a .pem file:
$ openssl x509 -in aps_development.cer -inform der -out PushChatCert.pem
# Convert the private key’s .p12 file into a .pem file:
$ openssl pkcs12 -nocerts -in PushChatKey.p12 -out PushChatKey.pem
# Finally, combine the certificate and key into a single .pem file
$ cat PushChatCert.pem PushChatKey.pem > ck.pem
# At this point it’s a good idea to test whether the certificate works.
@kublaios
kublaios / gist:226dbea44105dd9b1c60
Created July 1, 2014 07:03
Sample iOS Game Sharing High Score With UIActivityViewController
- (void)share:(NSNotification *)notification {
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, 0);
[self.view drawViewHierarchyInRect:self.view.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// high score stuff
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"score"]) {
@kublaios
kublaios / git.sh
Created July 10, 2014 13:08
Shell script to add, commit and push changes in a single line of code
git add -A;
git commit -m "$1";
git push origin $2
@kublaios
kublaios / record_objects.php
Created July 12, 2014 07:29
Sample record function for using PDO's rollback transaction funcs.
<?php
/**
* Sample record function for using PDO's rollback transaction funcs.<br />
* <b>By: </b>Kubilay Erdogan
* @param array $objects Object objects array (each object must be created)
* @return array Result array
*/
public function recordObjects($objects = array()) {
if (count($objects) == 0) { $objects = $this->objects; } // set fields to self property if empty
if (count($objects) == 0) return true; // if still empty, then return.
@kublaios
kublaios / pdo_duplicate_key_update.php
Created July 12, 2014 09:54
PDO ON DUPLICATE KEY UPDATE for multiple insert rows
function test() {
$sql = "INSERT INTO `table` (`id`, `name`) VALUES (?,?),(?,?) ON DUPLICATE KEY UPDATE `name` = VALUES(`name`) ";
$values = array(1, "test", 2, "so so");
$stmt = $this->db->prepare($sql);
$stmt->execute($values);
}
@kublaios
kublaios / user_templates.py
Last active August 29, 2015 14:04
Sublime Text PHP Getters and Setters Plugin Tiny Template
class camelCaseTiny(object):
name = "camelCaseTiny"
style = 'camelCase' # can also be snakeCase
getter = """
public function get%(normalizedName)s() { return $this->%(name)s; }"""
setter = """
public function set%(normalizedName)s(%(typeHint)s $%(name)s) { $this->%(name)s = $%(name)s; }"""
@kublaios
kublaios / gist:0609617440a10d393904
Created July 23, 2014 07:49
Path /usr/local/bin
echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile