Skip to content

Instantly share code, notes, and snippets.

View cs3b's full-sized avatar

Michał Czyż cs3b

View GitHub Profile
@cs3b
cs3b / gist:4081597
Created November 15, 2012 21:58
Setup project for RuPy Workshop
git clone git@github.com:cs3b/tasks.git -b rupy
# enter directory
cd tasks
# install gems
bundle
# setup databases
using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
@cs3b
cs3b / chess_board.coffee
Last active August 29, 2015 14:22
Eloquent JavaScript (chapter 2 # Excersise)
chessBoard = (size, chars) ->
result = ''
for i in [1..size*size]
result += chars[i % chars.length]
if i % size is 0
result += '\n'
if size % chars.length is 0
chars = [chars[1], chars[0]]
i++
result
@cs3b
cs3b / bean_counting.coffee
Last active August 29, 2015 14:22
Eloquent JavaScript (chapter 3 # Excersise)
countBs = (text) ->
countChar text, 'B'
countChar = (text, char) ->
count = 0
for i in [0..text.length]
count++ if text[i] == char
count
@cs3b
cs3b / a_list.coffee
Last active August 29, 2015 14:22
Eloquent JavaScript (chapter 4 # Excersise)
arrayToList = (elements) ->
{ value: elements.shift(), rest: if elements.length == 0 then null else arrayToList(elements) }
listToArray = (list) ->
if list.rest is null then [list.value] else [list.value].concat(listToArray(list.rest))
nth = (list, element_index, index) ->
index = 0 if index is undefined
if list is null
null

Ubuntu setup.

Preparations

First of all you should download and install K/Ubuntu 14.04 LTS. Then open software center, navigate to [ edit / software sources / other software tab ] and check “Canonical Partners” for the software sources.

Then:

@cs3b
cs3b / controllers.application.js
Created October 13, 2016 01:14
two way binding - wtf
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@cs3b
cs3b / components.paper-pickaday.js
Last active March 11, 2017 15:25
PaperPickaday for ember-paper
import Ember from 'ember';
import PikadayMixin from 'ember-pikaday/mixins/pikaday';
import PaperInput from 'ember-paper/components/paper-input';
import layout from 'ember-paper/templates/components/paper-input';
export default PaperInput.extend(PikadayMixin, {
layout,
didInsertElement() {
this._super(...arguments);
@cs3b
cs3b / prepare.app.sh
Last active March 14, 2017 10:31
Prepare Ember app for PaperPickaday
ember install ember-pikaday
ember g component --pod paper-pikaday