Skip to content

Instantly share code, notes, and snippets.

🙌

Fatih Acet fatihacet

🙌
Block or report user

Report or block fatihacet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
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,
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 / 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;
@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) {
@fatihacet
fatihacet / isValidURL.js
Created Oct 11, 2011
URL validator regex
View isValidURL.js
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 / just-number.js
Last active Dec 10, 2015
get only numbers in a string with regex
View just-number.js
var k = '3dsaAdas2dAAASdasdasDŞ321ĞİÜEQWEWQ098"**?_Ü;SDA!22';
k.replace(/\D/g, '');
You can’t perform that action at this time.