Skip to content

Instantly share code, notes, and snippets.

@henrahmagix
henrahmagix / git-demo-tree-hashes.sh
Last active July 20, 2016 16:11
Git Presentation Demo: tree hashes
# More info at http://unix.stackexchange.com/questions/165369/whats-the-difference-between-commit-hash-parent-hash-and-tree-hash-in-gi
# Make two git repositories with the same first commit and compare logs
for dir in {a,b}; do
mkdir $dir
(
cd $dir
(
git init
echo 'foo' > foo
git add foo
@henrahmagix
henrahmagix / git-demo-commits.sh
Created July 20, 2016 15:56
Git Presentation Demo: commits
git init
git commit --allow-empty -m 'Initial commit'
# Commit a file
echo 'foo' > a
git add a
git commit -m 'Commit'
# Commit another file with the same contents
echo 'foo' > b
git add b
git commit -m 'Commit'

Reasons I use Sublime Text

  • I already use it
  • Multiple cursors

Reasons I want to use vim

  • It has multiple cursors now
  • I don't want to get left behind =(
@henrahmagix
henrahmagix / README.md
Last active August 29, 2015 14:24
Performance difference between angular modules taking care of their dependencies or requiring sub-modules that take care of their own dependencies.

Perf test for modular modules

Instructions

For when JSPerf is down, which it is currently.

  • Preserve your console log
  • Type #typical into the url
  • Refresh the browser ten times
  • Average all the times together
@henrahmagix
henrahmagix / angular-event-bus.js
Last active August 29, 2015 14:17
A method for using $rootScope as a global events bus. Currently leaky: need to delete events after deregistration.
app.service('AppEvents', [
'$rootScope', '$log',
function ($rootScope, $log) {
// Store for callback functions.
this._events = {};
// Deregister an event.
var deregister = function (offFunc) {
if (offFunc) {
@henrahmagix
henrahmagix / canvas.js
Created February 20, 2015 14:54
Canvas angular module beginnings
(function (angular, _) {
'use strict';
var module = angular.module('canvas', [
'swipe'
]);
// In your article:
// <div canvas-circle value="0" min="0" max="100"></div>
app.directive('canvasCircle', [
.DS_Store
*.pyc
*.sw[o|p]
*.un~
.project
.rvmrc
._*
.venv
.ropeproject
.sass-cache
[core]
excludesfile = ~/.gitignore
whitespace = blank-at-eol,cr-at-eol,tab-in-indent
[user]
name = <name>
email = <email>
[github]
user = <username>
{
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
".sass-cache"
],
"ensure_newline_at_eof_on_save": true,
@henrahmagix
henrahmagix / mobile-webapp.html
Last active August 29, 2015 14:14
If setting the meta charset, does that define it for all links?
<!-- Charset is in http-equiv -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Does Charset have to be defined in an attribute? -->
<link type="text/css" charset="utf-8" rel="stylesheet" href="media/styles/application.css" />