Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Blessing Mashoko mashcom

🎯
Focusing
Block or report user

Report or block mashcom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mashcom
mashcom / factorial.py
Created Jun 16, 2014
calculate factorials in python.
View factorial.py
# calculate factorial
# @author: Mashoko Blessing
# @http://www.facebook.com/blessing.mashcom
# @mashcom digimedia http://www.hookd-up.com
#email: bmashcom@hotmail.com
def factorial(x):
if(x==0):
return 1
else:
@mashcom
mashcom / forloop.c
Created Jun 16, 2014
basic forloop statement in c
View forloop.c
# include <stdio.h>
int main(int argc, char * argv[]){
int i=0;
// go through each string in argv
// why am I skipping argv[0]?
for(i = 1; i < argc; i++) {
printf("arg %d: %s\n", i, argv[i]);
View pointer.c
#include <stdio.h>
int main(int argc, char * argv[]){
int ages[]={12,56,23,34,51};
char *name[]={"blessing","tawanda","prosper","simba","titi"};
int count=sizeof(ages)/sizeof(int);
int i=0;
@mashcom
mashcom / trajectory.py
Last active Aug 29, 2015
this is beginners demo of how to calculate trajectory using python. this code is not validated and there are no exception catching mechanisms, it for learning purposes
View trajectory.py
# calculate trajetory
# @author: Mashoko Blessing
# @ http://www.facebook.com/blessing.mashcom
# @mashcom digimedia http://www.hookd-up.com
from math import sin,cos,pi
def calculateTraf(angle, velocity ):
#defining gravity
@mashcom
mashcom / files.py
Created Jun 16, 2014
files io basic
View files.py
#read file
# calculate trajetory
# @author: Mashoko Blessing
# @ http://www.facebook.com/blessing.mashcom
# @mashcom digimedia http://www.hookd-up.com
import os
def isFileAvailable(myfile):
if(os.path.isfile(myfile)):
@mashcom
mashcom / arrays.c
Created Jun 16, 2014
basic array in c
View arrays.c
#import <stdio.h>
int main(int argc, char * argv[]){
int areas[]={10,67,7,90,89};
printf("the size of ints id %ld",sizeof(int));
printf("the first character of array is %d",areas[0]);
return 0;
};
@mashcom
mashcom / wp_get_children.php
Created Apr 19, 2018
Get children of a current page
View wp_get_children.php
<?php
$id = the_ID();
while ( have_posts() ) : the_post();
$gp_args = array(
'post_type' => 'page',
'post_parent' => $id,
'order' => 'ASC',
'orderby' => 'menu_order',
'posts_per_page' => -1
);
@mashcom
mashcom / .htaccess
Created Jun 13, 2018
General Redirect Rules
View .htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
You can’t perform that action at this time.