Skip to content

Instantly share code, notes, and snippets.

@adelura
adelura / ufdu
Last active August 29, 2015 14:08
temp
// So if I have something like this:
// <p>foo<i>baa</i> </p>
// Empty text node-^--
var a = getEmptyTextNodeInAboveP();
a.getIndex() // 2
a.getIndex( true ) // -1 ????
@adelura
adelura / opis.md
Last active August 29, 2015 14:17
Jakość kodu

Jakość i czytelność kodu.

Bardzo ważne jest, żeby kod, który piszemy był czytelny. Czemu?

  • taki kod czyta się przyjemnie i szybko (nie tylko nam).
  • jeżeli styl kodu definiują pewne reguły, to nawet gdy nam kodem pracuje parę osób, to można odnieść wrażenie, jakby pisała go jedna osoba.
  • piszac kod, często wracamy do niego pewnym czasie - warto jest zadbać o to, żeby czas poznawania swojego skryptu, który napisaliśmy był jak najmniej bolesny.

Co składa się na czytelny kod?

@adelura
adelura / mock-service-example.js
Last active September 9, 2015 16:28 — forked from alicial/mock-service-example.js
AngularJS: Setting up a mocked service to use in controller unit tests.
// Mocked Service
angular.module('mock.users', []).
factory('UserService', function($q) {
var userService = {};
userService.get = function() {
return {
id: 8888,
name: "test user"
}

JSHint

/* globals MY_GLOBAL */

/* jshint ignore:start */
/* jshint ignore:end  */
// some comment
function hello() {
if () {
} else {
console.log('my name is Artur Delura');
}
}
@adelura
adelura / README.md
Created March 23, 2017 17:22 — forked from hubgit/README.md
A5 printed card with HTML + CSS
  1. Clone this Gist.
  2. For card sizes other than A5, edit the size value in @page, and the height and width properties of body.
  3. Add contents to each face. The simplest approach is to add an image called front.png of the same dimensions as the card.
  4. Generate a PDF from the HTML + CSS. If using Prince, it's as simple as prince index.html card.pdf.
  5. Take the PDF to a printer, and ask them to print as many copies as you need.
public class Hello
{
   public static void Main()
   {
-      System.Console.WriteLine("Hello, World!");
+      System.Console.WriteLine("Rock all night long!");
   }
}