Skip to content

Instantly share code, notes, and snippets.

View williwambu's full-sized avatar

William Muli williwambu

  • Nairobi,Kenya
View GitHub Profile
@williwambu
williwambu / laravel4-on-shared-hosting
Last active August 23, 2016 18:33
Guide to configuring laravel on shared hosting
Laravel can can hosted in shared hosting environments. One can upload all files into puplic_html(www) folder.This comes with some problems:
- Exposes your code to the public
- To view the site you have to use http://your_domain/public or use url rewriting
To avoid this you have to separate the public folder from the other laravel files.
This is how i do it:
1. Create a folder above public_html or www in some environments. Call it laravel
2. Upload all the files in your laravel application to this folder except public folder
3.upload the contents of public folder to public_html or www
#include <iostream>
using namespace std;
/*
a function to calculate the total cost of an accomodation
@param accomodationType is accomodation type
@param numberOfDays is days of stay
*/
float calculateTotalCost(string accomodationType,int numberOfDays){

DOWNLOADING VIDEOS FROM PLURALSIGHT USING YOUTUBE-DL

Youtube-dl can be used to download course videos from pluralsight

   $ youtube-dl --username <myusername> --password <mypassword> "URL to course outline"

Pluralsight may lock you out of your account after you download a lot of content from the site.

<div class="wizard">
<div class="card-header" data-background-color="purple">
Create/Add new officer
</div>
<div class="card-content">
<div class="col-md-9">
<div class="row">
<div class="col-md-3 col-sm-4 col-xs-8">
<div class="wizard-side-nav">
<ul class="nav nav-pills nav-pills-info nav-stacked">
@williwambu
williwambu / get-svg-path-length.js
Last active September 3, 2018 06:38
get-svg-path-length.js
const path = document.querySelector('path-selector');
const pathLength = path.getTotalLength();
/**
* Get x,y coordinates at a given distance along the path
* @param {number} distance Distance along the path
* @returns {SVGPoint} x,y coordinate
*/
const point = path.getPointAtLength(distance);
// Get two close points
const point1 = path.getPointAtLength(distance);
const point2 = path.getPointAtLength(distance + 1);
// Get angle(radians)
// Convert to degrees
const angle = Math.atan2(point1.y - point2.y, point1.x - point2.x) * (180 / Math.PI);
const {x, y } = path.getPointAtLength(distance);
const circle = document.querySelector('item-selector');
circle.setAttribute("transform", `translate(${x}, ${y}) rotate(${angle})`);
@williwambu
williwambu / Inbox.sol
Created October 19, 2018 12:36
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.17+commit.bdeb9e52.js&optimize=false&gist=
pragma solidity ^0.4.0;
contract Inbox {
string public message;
function Inbox(string initialMessage) public {
message = initialMessage;
}
function setMessage(string newMessage) public {