Skip to content

Instantly share code, notes, and snippets.

View fatihacet's full-sized avatar
🤙

Fatih Acet fatihacet

🤙
View GitHub Profile
@fatihacet
fatihacet / pubsub-simple.js
Created October 15, 2011 22:02
Simple PubSub implementation with JavaScript - taken from Addy Osmani's design patterns book -
var pubsub = {};
(function(q) {
var topics = {}, subUid = -1;
q.subscribe = function(topic, func) {
if (!topics[topic]) {
topics[topic] = [];
}
var token = (++subUid).toString();
topics[topic].push({
token: token,
@fatihacet
fatihacet / jquery.ajax-queue.js
Created October 15, 2011 21:46
Simple and easy jQuery AJAX queue implementation trying - this is draft version -
$.ajaxQueue = [];
var que = $.ajaxQueue;
$.ajaxSetup({
beforeSend: function(){
if (this.queue) {
que.push(this);
}
else {
return true;
@fatihacet
fatihacet / karma.conf.js
Created December 20, 2014 14:44
Sample karma.conf.js
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'build/js/**/*.js',
'build/tests/**/test_*.js'
],
exclude: [
],
@fatihacet
fatihacet / sample.json
Created December 9, 2012 23:32
Sample array of object json
[
{
"id": 1,
"body": "First Item",
"severity": 1,
"status": 0
},
{
"id": 2,
"body": "Second Item",
@fatihacet
fatihacet / isValidURL.js
Created October 11, 2011 12:31
URL validator regex
function isUrl(s) {
var regexp = /((http|https):\/\/)?[A-Za-z0-9\.-]{3,}\.[A-Za-z]{2}/;
return s.indexOf(' ') < 0 && regexp.test(s);
}
isUrl('http://fatihacet.com.tr')
@fatihacet
fatihacet / compressed.sh
Created October 11, 2012 08:19
Compressing all css files into one file with YUI Compressor.
#!/bin/sh
#usage : ./scripts/minify.sh
echo "Deleting old content of compressed file..."
echo "" > css/compressed/all.css
echo "Combining all css files into one.."
cat \
css/reset.css \
@fatihacet
fatihacet / get-wp-feeds.js
Created January 15, 2012 01:47
Get WordPress feeds xml by jQuery Ajax request.
$.ajax({
type: 'GET',
dataType: 'xml',
url: '/feed',
success: function(xmlDocument) {
var rss = $(xmlDocument.firstChild);
console.log(rss.find('item'));
}
});
@fatihacet
fatihacet / sublime.conf.json
Last active May 6, 2019 07:33
sublime.conf
{
"close_windows_when_empty": false,
"color_scheme": "Packages/One Dark Color Scheme/One Dark.tmTheme",
"detect_indentation": false,
"enable_tab_scrolling": false,
"ensure_newline_at_eof_on_save": true,
"env":
{
"PATH": "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/share/npm/bin/"
},
@fatihacet
fatihacet / package.json
Created June 1, 2015 14:35
Easily switch between your two predefined themes for Sublime Text.
{
"name": "themeswitch",
"version": "0.0.1",
"description": "Easily switch between your two predefined themes for Sublime Text.",
"dependencies": {},
"devDependencies": {
"coffee-script": "^1.9.3",
"json-format": "0.0.1"
},
"author": "Fatih Acet <fatih@fatihacet.com>"
@fatihacet
fatihacet / app.js
Last active February 1, 2017 15:38
Generic Vue validation
new Vue({
el: '#app',
methods: {
validate() {
VueValidator(this, () => {
console.log('single input is valid');
});
}
}
})