Skip to content

Instantly share code, notes, and snippets.

Avatar
🙌

Fatih Acet fatihacet

🙌
View GitHub Profile
@fatihacet
fatihacet / pubsub-simple.js
Created Oct 15, 2011
Simple PubSub implementation with JavaScript - taken from Addy Osmani's design patterns book -
View pubsub-simple.js
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 / compressed.sh
Created Oct 11, 2012
Compressing all css files into one file with YUI Compressor.
View compressed.sh
#!/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 Jan 15, 2012
Get WordPress feeds xml by jQuery Ajax request.
View get-wp-feeds.js
$.ajax({
type: 'GET',
dataType: 'xml',
url: '/feed',
success: function(xmlDocument) {
var rss = $(xmlDocument.firstChild);
console.log(rss.find('item'));
}
});
@fatihacet
fatihacet / jquery.ajax-queue.js
Created Oct 15, 2011
Simple and easy jQuery AJAX queue implementation trying - this is draft version -
View jquery.ajax-queue.js
$.ajaxQueue = [];
var que = $.ajaxQueue;
$.ajaxSetup({
beforeSend: function(){
if (this.queue) {
que.push(this);
}
else {
return true;
View sublime.conf.json
{
"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 Jun 1, 2015
Easily switch between your two predefined themes for Sublime Text.
View package.json
{
"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 / karma.conf.js
Created Dec 20, 2014
Sample karma.conf.js
View karma.conf.js
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'build/js/**/*.js',
'build/tests/**/test_*.js'
],
exclude: [
],
@fatihacet
fatihacet / app.js
Last active Feb 1, 2017
Generic Vue validation
View app.js
new Vue({
el: '#app',
methods: {
validate() {
VueValidator(this, () => {
console.log('single input is valid');
});
}
}
})
@fatihacet
fatihacet / numberPaste.js
Created Nov 15, 2012
Allow pasting only numbers
View numberPaste.js
$('#securityCode').bind('paste', function() {
var el = this;
setTimeout(function() {
el.value = el.value.replace(/\D/g, '');
}, 0);
});
@fatihacet
fatihacet / input.scss
Last active Aug 8, 2016
Use Scss map and map_get to get dynamic variables from map.
View input.scss
$white_foo_bar: #FFF;
$map: (
foo: 'foo',
bar: 'bar',
baz: 'white',
foowhite: 'foowhitecolor'
);
@mixin foo($type) {
You can’t perform that action at this time.