Skip to content

Instantly share code, notes, and snippets.

setttings
@Ollo
Ollo / server.js
Created May 5, 2015 15:04
simple node http server
"use strict";
var https = require('https');
var fs = require('fs');
var qs = require('querystring');
var options = {
key: fs.readFileSync('server.key'),
cert: fs.readFileSync('server.crt')
};
@Ollo
Ollo / pagination.php
Created January 25, 2015 17:56
wp pagination
// paging code
// Query to count rows.
$result = mysql_query("SELECT * FROM Table_Name WHERE Column_Name = '$section'")
$items = 32; // number of items per page.
$all = $_GET['a'];
$num_rows = mysql_num_rows($result);
if($all == "all"){
$items = $num_rows;
@Ollo
Ollo / walker.php
Created January 25, 2015 17:55
wp_nav walker class
// walker menu for breadcrumbs
wp_nav_menu( array(
'container' => 'none',
'theme_location' => 'header-menu',
'walker'=> new SH_BreadCrumbWalker,
'items_wrap' => '<div id="breadcrumb-%1$s" class="%2$s">%3$s</div>'
));
class SH_BreadCrumbWalker extends Walker{
@Ollo
Ollo / ng-moment.js
Created December 16, 2014 15:50
ng-moment-wrapper.js
define([
'angular',
'moment'
], function(angular, moment) {
'use strict';
angular.module('common.moment', [])
.factory('dateService', function() {
.overview_header {
border-bottom: 1px solid $gloo_gray;
@include outer-container;
padding: 1rem 0 2rem;
margin-bottom: 2rem;
.average {
@include span-columns(6);
}
@Ollo
Ollo / push-nav.js
Created October 10, 2014 17:44
push-nav
.provider("$egPushMenuPrimary", function(){
if(window.screen.availWidth <= 1024) {
this.$get = [function(){
var menu = {};
menu.show = function show(){
var menu = angular.element(document.querySelector('#sp-nav'));
console.log(menu);
@Ollo
Ollo / angular-modules.js
Created October 8, 2014 22:39
angular module pattern example
// user-profile-controller.js
define([
'angular',
'components/userProfile/user-profile-factory.js',
'components/userProfile/user-profile-directives.js',
],
function(){
'use strict';
@Ollo
Ollo / mock-user-details.js
Last active August 29, 2015 14:06
mock data
$scope.userBasicDetails.relationshipStages = [
{ id : "Single", name: "Single"},
{ id : "Married", name: "Married"}
];
// TODO: Display the correct amount of days in dropdown according to month.days
$scope.userBasicDetails.months = [
{ id : "Janurary", name: "Janurary", days: '31' },
{ id : "February", name: "February", days: '28' },
{ id : "March", name: "March", days: '31' },
@Ollo
Ollo / global-auth
Created September 25, 2014 21:45
makes auth token global
// session-service.js
this.setAuth = function(token) {
if (!!token && !localStorage.getItem('Token')) {
setTokenToLocalStore(token);
}
$http.defaults.headers.common.Authorization = token ? "Token " + token : localStorage.getItem("Token");
}
// app-controller.js