Skip to content

Instantly share code, notes, and snippets.

View vinitkumar's full-sized avatar
🪀
Focusing

Vinit Kumar vinitkumar

🪀
Focusing
View GitHub Profile
@vinitkumar
vinitkumar / .zshrc
Created February 4, 2014 05:35
zshrc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="lambda"
alias server='python -m SimpleHTTPServer'
@vinitkumar
vinitkumar / clean-code.js
Last active August 29, 2015 13:56
cleaner code in js
// 6: how could you improve the following code?
$(document).ready(function() {
$('.foo #bar').css('color', 'red');
$('.foo #bar').css('border', '1px solid blue');
$('.foo #bar').text('new text!');
$('.foo #bar').click(function() {
$(this).attr('title', 'new title');
$(this).width('100px');
});
@vinitkumar
vinitkumar / background.js
Created February 26, 2014 17:50
Object literal based design for chrome extension
var getAccess = {
config : {
client_id: '255350354640375',
client_secret: '0206d7cd66962dd59d90472d810c3464',
successURL: 'http://gotchacode.github.io'
},
init: function (config) {
truncate auth_user, auth_message, auth_user_groups, auth_user_user_permissions CASCADE;
var console = new Console();
var done = function (this) {
console.log('This looks and works sexy');
}
proy.on("all", function (eventName) {
object.trigger(eventName);
});
book.on({
"change:title": titleView.update,
"change:author": authorPane.update,
"destroy": bookView.remove
});
proy.on("all", function (eventName) {
object.trigger(eventName);
});
book.on({
"change:title": titleView.update,
"change:author": authorPane.update,
"destroy": bookView.remove
});
import {isFunction} from './utils';
class SuperConstructor {}
class InjectAnnotation {
constructor(...tokens) {
this.tokens = tokens;
this.isPromise = false;
}
}
/* gettext library */
var catalog = new Array();
function pluralidx(count) { return (count == 1) ? 0 : 1; }
function gettext(msgid) {
var value = catalog[msgid];
// Helper function to urlify links in the text.
function urlify(text) {
var urlRegex = /(https?:\/\/[^\s]+)/g;
return text.replace(urlRegex, function(url) {
return text.replace(urlRegex, '<a href="$1" target="_blank">$1</a>');
})
}