Skip to content

Instantly share code, notes, and snippets.

View izelnakri's full-sized avatar
🇺🇦
Ember.js is the best.

Izel Nakri | izelnakri.eth izelnakri

🇺🇦
Ember.js is the best.
View GitHub Profile
@izelnakri
izelnakri / session_index.coffee
Last active August 29, 2015 13:57
My ancient/badly written backbone view example.
class PhilateliSt.Views.SessionsIndex extends Backbone.View
template: JST['sessions/index']
el: ".lotsrow"
events:
'click #create_lot': 'createLot'
'click .lotta': 'selectLot'
'keydown .js-input': 'updateLot'
'focusout .js-input': 'updateLot'
@izelnakri
izelnakri / putzplan.coffee
Last active August 29, 2015 14:01
Putzplan
#Assigns the tasks and sends an email every week.
#Deployed as a heroku worker(requires a Procfile in the same directory)
require 'coffee-script'
require 'colors'
nodemailer = require('nodemailer')
getWeekNumber = (d) ->
# Copy date so don't modify original
d = new Date(+d)
d.setHours 0, 0, 0
@izelnakri
izelnakri / development.rb
Last active August 29, 2015 14:07
My Auto-minification code for JS templates on Rails!
#on "config/environments/development.rb"
#fixes display:inline-block positioning problems with whitespaced HTML
#reduces JS template filesize
#introduces a convention to use //= require_tree ./templates/compiled on application.coffee
#requires listen gem v2 + htmlcompressor
Rails.application.configure do
#development.rb defaults...
var requirejs,require,define;!function(global){function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){if(e){var i;for(i=0;i<e.length&&(!e[i]||!t(e[i],i,e));i+=1);}}function eachReverse(e,t){if(e){var i;for(i=e.length-1;i>-1&&(!e[i]||!t(e[i],i,e));i-=1);}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var i;for(i in e)if(hasProp(e,i)&&t(e[i],i))break}function mixin(e,t,i,r){return t&&eachProp(t,function(t,n){(i||!hasProp(e,n))&&(!r||"object"!=typeof t||!t||isArray(t)||isFunction(t)||t instanceof RegExp?e[n]=t:(e[n]||(e[n]={}),mixin(e[n],t,i,r)))}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,i,r){var n=new Error
@izelnakri
izelnakri / gist:30c5aa8f704678dfb592
Last active September 22, 2015 08:55
New component html suggestions
<!-- EO-THUMBNAIL -->
<eo-thumbnail eo-background="background-image: url('//cdn2.hubspot.net/hubfs/378889/Blog_photos/shutterstock_307289936.jpg?t=1442836074839');"
eo-href="http://blog.eyeopen.nl/huis-kopen/voorlopig-koopcontract-3-dingen-om-op-te-letten">
<small class="hidden-sm text-muted">Voorlopig koopcontract</small>
<small class="text-muted hidden-sm pull-right"><i class="icon icon-clock-o icon-fw"></i>Sep 18, 2015</small>
<h4><a href="{{eoHref}}">Voorlopig koopcontract: 3 dingen om op te letten</a></h4>
var gulp = require('gulp'),
shell = require('gulp-shell'),
runSequence = require('run-sequence'),
stylish = require('jshint-stylish'),
concat = require('gulp-concat'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify');
gulp.task('watch', ['riot'], function () {
return gulp.watch('app/assets/javascripts/components/*.tag', ['riot'])
atom configuration
class APIController < ActionController::API
include ActionController::HttpAuthentication::Token
include ActiveSupport::SecurityUtils
rescue_from ActiveRecord::RecordNotFound, with: :not_found
def not_found
api_error(status: 404, errors: 'Not found')
end
class FirstTry
attr_accessor :data
def default_content
@data ||= begin
puts "First function call"
puts "second function call"
5
end
end
var App = function(params) {
var cardNumbers = [
2, 3, 4, 5, 6, 7, 8, 9,
10, 'J', 'Q', 'K', 'A'
],
cardTypes = ['Clubs', 'Diamonds', 'Hearts', 'Spades'];
var app = {
VERSION: '0.0.1',
isActive: false,