Skip to content

Instantly share code, notes, and snippets.

View evandertino's full-sized avatar
🎧
In the zone

Evander Otieno evandertino

🎧
In the zone
  • Foursquare
  • Nairobi, Kenya
View GitHub Profile
/**
* Usage:
* {{some_text | cut:true:100:' ...'}}
* Options:
* - wordwise (boolean) - if true, cut only by words bounds,
* - max (integer) - max length of the text, cut to this number of chars,
* - tail (string, default: ' …') - add this string to the input
* string if the string was cut.
*/
angular.module('ng').filter('cut', function () {
angular.module('app', []).
filter('myfilter', function() {
return function(in, param1, param2, param3) {
// do something
};
});
@evandertino
evandertino / analytics.html
Created December 23, 2013 15:04
Google Analytics
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-X');
ga('send', 'pageview');
</script>
@import "compass/css3/images";
// CSS-only multi-line ellipsis with generated content
// yields `position:relative`, so remember to declare an eventual `position:absolute/fixed` *after* including this mixin
@mixin limitLines(
$maxLinesPortrait, // Mandatory: The number of lines after which the clipping should take action.
$maxLinesLandscape: $maxLinesPortrait, // You may provide a different line limit for landscape orientation.
// Note that 'portrait' is our default orientation. However, if you omit $maxLinesLandscape,
// the value of $maxLinesPortrait is used for whatever orientation (that is, without a media query).
#Quick cp from http://sekati.com/etc/install-nodejs-on-debian-squeeze
#
#Needed to install TileMill from MapBox
#
#Installs node.js which has npm bundled
#
#Build Dependencies
sudo apt-get update
@evandertino
evandertino / ssh-agent
Created February 12, 2014 17:49 — forked from rezlam/ssh-agent
SSH_ENV="$HOME/.ssh/environment"
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV"
echo succeeded
chmod 600 "$SSH_ENV"
. "$SSH_ENV" > /dev/null
@evandertino
evandertino / mysql
Created June 2, 2014 12:42
vagrant mysql inputs
Mysql Host: 192.168.56.101 (or ip that you choose for it)
username: root (or mysql username u created)
password: **** (your mysql password)
database: optional
port: optional (unless you chose another port, defaults to 3306)
ssh host: 192.168.56.101 (or ip that you choose for this vm, like above)
ssh user: vagrant (vagrants default username)
ssh password: vagrant (vagrants default password)
ssh port: optional (unless you chose another)
@evandertino
evandertino / Structs.c
Last active August 29, 2015 14:05
Back to C
#include <stdio.h>
void print(void);
unsigned long getId(void);
unsigned char getAge(void);
struct Student {
unsigned char Age;
unsigned long Student_ID;
void (*print)();
@evandertino
evandertino / server.js
Last active August 29, 2015 14:05
A Simple NodeJS File Server with caching abilities
/*
* Before executing this script
*
* 1. Create a dir named content
* 2. With an index.html that requests for files e.g css
*
* This simple server will automatically fetch the
* requested resource from the content directory
*
* author: Evander Tino
@evandertino
evandertino / server.js
Last active August 29, 2015 14:05
A simple Nodejs File server that streams non-requested resources to the client and loads already requested resources from a simple cache
/*
* Before executing this script
*
* 1. Create a dir named content
* 2. With an index.html that requests for files e.g css
*
* This simple server will automatically stream the
* requested resource from the content directory to the client
*
* author: Evander Tino