Skip to content

Instantly share code, notes, and snippets.

@baniol
baniol / nodejs-tcp-example.js
Last active September 11, 2015 10:29 — forked from tedmiston/nodejs-tcp-example.js
Node.js tcp client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@baniol
baniol / jshint_hook.py
Created April 11, 2014 09:01 — forked from matthewlein/.jshintrc
jshint, git hook, python script
{
"devel": false,
"undef": true
}
@baniol
baniol / _media-queries.scss
Created July 9, 2013 22:18 — forked from stammy/_media-queries.scss
css media queries sass
// $mq-mobile-portrait : 320px !default;
// $mq-mobile-landscape : 480px !default;
// $mq-tablet-portrait : 640px !default; -- changed because i want my blog content is around this wide, not 768. you should let content & design determine your breakpoints
// $mq-tablet-landscape : 1024px !default;
// $mq-desktop : 1382px !default;
$mq-mobile-portrait : 20em !default;
$mq-mobile-landscape : 30em !default;
$mq-tablet-portrait : 40em !default;
$mq-tablet-landscape : 64em !default;
// Media Queries in Sass 3.2
//
// These mixins make media queries a breeze with Sass.
// The media queries from mobile up until desktop all
// trigger at different points along the way
//
// And important point to remember is that and width
// over the portrait width is considered to be part of the
// landscape width. This allows us to capture widths of devices
// that might not fit the dimensions exactly. This means the break
@baniol
baniol / app.js
Created June 11, 2013 10:45 — forked from rktjmp/app.js
angular module coffeescript
// Make our app module, its easier to do this in raw javascript
// and then put the rest of our app content (controllers etc)
// in their own coffeescript files.
//
// Your ng-app should include this module name, eg: <html ng-app="TodoApp">
angular.module('TodoApp', []);
@baniol
baniol / todo.coffee
Created June 11, 2013 10:45
todo app angular coffeescript
# Original source at: http://angularjs.org/#todo-js
window.TodoCtrl = ($scope) ->
$scope.todos = [
{text: 'learn angular', done: true},
{text: 'build an angular app', done: false}
]
$scope.addTodo = ->
var casper = require('casper').create();
casper.start();
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)');
casper.viewport(1024, 768);
casper.thenOpen('http://jsbin.com/ifuma#noedit', function() {
this.capture('test.png');
<?php
/**
* Controller Test Case
*
* Provides some convenience methods for testing Laravel Controllers.
*
* @author Joseph Wynn <joseph@wildlyinaccurate.com>
*/
abstract class ControllerTestCase extends PHPUnit_Framework_TestCase
@baniol
baniol / create-vhost.py
Created January 19, 2013 12:52 — forked from paramah/create-vhost.py
create vhost for nginx
#!/usr/bin/python
import os, sys, getopt, socket
from pwd import getpwnam
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "hd:u:t:s:", ["help", "domain="])
except getopt.GetoptError, err:
print str(err)
usage()
@baniol
baniol / create-vhost.py
Last active December 11, 2015 08:19 — forked from paramah/create-vhost.py
create apache vhost for linux
#!/usr/bin/python
import os, sys, getopt, socket, stat
from pwd import getpwnam
# important: you have to manually put #@host@ into /etc/hosts file !
# important : you have to call the script from within the target directory !
SITES_DIR = "/etc/apache2/sites-available/"
SCRIPT_DIR = "/home/marcin/scripts/"
HOSTS_FILE = "/etc/hosts"