Skip to content

Instantly share code, notes, and snippets.

View bbasata's full-sized avatar

Baraa Basata bbasata

View GitHub Profile
@davemo
davemo / Anonymous Function Testing.js
Created February 9, 2011 17:46
A pattern for testing anonymous functions and asserting expected behaviour through nested calls using JasmineBDD.
// Notes: This is a way @Searls and I came up with that lets you
// test deeply nested anonymous functions and callbacks.
// We don't recommend nesting things this deep but we _do_ like the closure scoping in the tests.
// Any suggestions or improvements would be welcome :)
// The Codez, A little modal window framework
(function($, _) {
$.cil = $.cil || {};
@jimweirich
jimweirich / exceptions.rb
Created March 7, 2011 02:55
How to organize exceptions in your library
# Suppose you were designing a library named "Zippo".
# How would you organize the exceptions thrown by the library.
# Option 1
# All library errors inheriting from a common base
module Zippo
class ZippoError < StandardError; end
class ZippoArgumentError < ZippoError; end
class ZippoTypeError < ZippoError; end
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@magnusstahre
magnusstahre / .screenrc
Created January 29, 2012 17:13
My .screenrc and .tmux.conf
escape ^Z^Z
bind z suspend
bind ^a other
@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
@avdi
avdi / gist:3842243
Created October 5, 2012 20:38
Observer pattern terminology

When it comes to the Observer pattern, there are a number of related, overlapping terms used by different codebases. Off the top of my head:

  • Observer/Observable/Subject
  • Listener/Listenable
  • Event/Event source/Event sink/Event handler
  • Hook/Callback
  • Subscriber/Subscribable
  • "Firing" vs. "Triggering" vs "Notifying" vs "Executing"

Which of these do consider to be synonymous?

@mattwynne
mattwynne / integrated_docs.rb
Created November 21, 2012 00:27
Integrated documentation for Ruby
# For context, this was inspired by the RubyRogues podcast #79 where they talked about
# documentation in Ruby, and specifically grumbled quite a bit about the failings of RDoc.
#
# http://rubyrogues.com/079-rr-documenting-code/
#
# As someone who's spent a lot of time using an IDE for programming C# and Java, I think
# Ruby could do a lot better at putting documentation at our fingertips as we program.
#
# Maybe making the documentation part of the structure of the code would facilitate this?
#
@4ndrej
4ndrej / SSLPoke.java
Last active July 23, 2024 15:12
Test of java SSL / keystore / cert setup. Check the comment #1 for howto.
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
## credit: http://fabian-affolter.ch/blog/the-lineinfile-module-of-ansible/
---
- hosts: alpine_install
user: root
tasks:
# - name: create a complete empty file
# command: /usr/bin/touch /test/test.conf
- name: create a new file with lineinfile

Reciprocal Needs in the Employment Relation

We can look at two sides of the management coin: What do the individuals get out of it? And what benefit does the whole system derive from it?

I will disregard any benefits that accrue to managers just by holding the position of managing. Those are just circular logic. Circular logic abounds in discussions of management and hierarchy. For example, consider status reports. It will be said that status reports are necessary so managers know what their employees are working on. It’s