Skip to content

Instantly share code, notes, and snippets.

Avatar

Kerem Güneş k-gun

  • Istanbul, Turkey
View GitHub Profile
View InspiredGitHub.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
Inspired GitHub Color Scheme for Sublime Text 3
Copyright 2015 Seth Lopez
Released under the MIT License <http://opensource.org/licenses/MIT>
https://github.com/sethlopezme/InspiredGitHub.tmtheme
-->
<plist version="1.0">
<dict>
View sublime-text-installation-instructions.md

Sublime Text 2 Installation Guide: Ubuntu 13.04 and Elementary OS Luna

1. Install Sublime Text 2

Open terminal

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text

2. Install Sublime Package Control

View matchAll.js
if (typeof RegExp.prototype.matchAll !== "function") {
RegExp.prototype.matchAll = function(v) {
var tmp = ""+ this, // So this.toString
src = tmp.lastIndexOf("/"),
pattern = tmp.substring(1, src),
flags = tmp.substring(src + 1, tmp.length);
// Never forget "g", that prepends infinite loops for "while"
if (flags.indexOf("g") == -1) {
flags += "g";
View get_attrs.php
<?php
$html = '<img class="medium" src="/images/image.jpg" width="100" height="75">';
// get attrs
preg_match_all('~([\w]+?)="(.*?)"~i', $html, $m);
$attrs = array_combine($m[1], $m[2]);
print_r($attrs);
// result
View avg.php
<?php
function avg(){
return array_sum(func_get_args()) / func_num_args();
}
function avgr($a){
return array_sum($a) / count($a);
}
View PHP.tmLanguage
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string>TODO:
• Try to improve parameters list syntax – scope numbers, ‘=’, ‘,’ and possibly be intelligent about entity ordering
• Is meta.function-call the correct scope? I've added it to my theme but by default it's not highlighted</string>
<key>fileTypes</key>
<array>
View trim_word_left.php
<?php
function trim_word_left($s, array $words) {
foreach ($words as $word) {
while (($p = mb_strpos($s, $word)) === 0) {
$s = mb_substr($s, $p + mb_strlen($word));
$s = trim($s);
}
}
return $s;
}
View JavaScript.tmLanguage
<!-- JavaScript.tmLanguage -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string>JavaScript Syntax: version 2.0</string>
<key>fileTypes</key>
<array>
<string>js</string>
View SQL.tmLanguage
<!-- SQL.tmLanguage -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>sql</string>
<string>ddl</string>
<string>dml</string>
View Old Github.tmTheme
<!-- Old Github.tmTheme -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
======================================================================
Github
======================================================================
A Sublime Text 2 / Textmate theme.
Copyright (c) 2012 Dayle Rees.
Released under the MIT License <http://opensource.org/licenses/MIT>
You can’t perform that action at this time.