Skip to content

Instantly share code, notes, and snippets.

View turboMaCk's full-sized avatar
🏠
Working from home

Marek Fajkus turboMaCk

🏠
Working from home
View GitHub Profile
@turboMaCk
turboMaCk / html5 snippet
Created October 22, 2013 15:34
Sublime Text HTML5 snippet. Open Sublime: Tools > New snippets => INSERT CODE; replace meta author; save with .sublime-snippet extension. then open blak file, type doctype and hit tab. <3
<snippet>
<content><![CDATA[
<!doctype html>
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en">
<![endif]-->
<!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8" lang="en">
<![endif]-->
<!--[if IE 8]>
@turboMaCk
turboMaCk / Preferences.sublime-settings
Created January 13, 2014 11:06
sublime-text-preferences
{
"always_prompt_for_file_reload": true,
"auto_indent": true,
"bold_folder_labels": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/Theme - Aqua/Color Schemes/Espresso Aqua.tmTheme",
"copy_with_empty_selection": false,
"create_window_at_startup": false,
"detect_indentation": true,
"draw_centered": false,
Ember.MediumEditor = Ember.View.extend({
editor: null,
initializeEditor: function() {
var self = this,
element = this.get('element');
this.valueObserver();
this.set('editor', new MediumEditor(element));
@turboMaCk
turboMaCk / index.html
Last active August 29, 2015 14:02
D3.js Chart Library Boilerplate
<html>
<head>
<title>test</title>
</head>
<body>
<div id="mydiv"></div>
<div id="mydiv2"></div>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
body {
background: #ccc
}
.quote {
position: relative;
display: block;
padding: 40px;
background: #fff;
border-radius: 3px;
(function() {
var defaultDuration = 500;
var scrollToElement = function($element, duration) {
// use body if no $element is defined
// use fdefault duration if is not sad different
$element = $element || $('body');
duration = duration || defaultDuration;
@turboMaCk
turboMaCk / jquery.inputresetable.js
Last active August 29, 2015 14:06
jQuery input resetable plugin prototype
(function() {
var InputResetable = function(element, defaultValue) {
this.element = element;
this.init(defaultValue);
};
InputResetable.prototype = {
init: function(defaultValue) {
@turboMaCk
turboMaCk / token_authenticable.rb
Created September 5, 2014 08:00
ActiveRecord (rails) token authenticable module
module TokenAuthenticatable
extend ActiveSupport::Concern
module ClassMethods
def find_by_authentication_token(authentication_token = nil)
if authentication_token
where(authentication_token: authentication_token).first
end
end
end
@turboMaCk
turboMaCk / object.json.rabl
Created September 6, 2014 12:12
Rabl-Rails has_many relation render array of IDs
# object.json.rabl
# This is not regular rabl template
# This example is using rabl-rails gem: https://github.com/ccocchi/rabl-rails
object :@product
attributes :id, :name, :description
node :categories do |item|
item.categories.map do |category|
category.id
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'a',
classNameBindings: ['active'],
attributeBindings: ['href'],
active: false,
href: '#',