Skip to content

Instantly share code, notes, and snippets.

View sedera-tax's full-sized avatar

Razafindrakoto Yannick Sedera Aina sedera-tax

View GitHub Profile
@sedera-tax
sedera-tax / index.html
Created December 28, 2015 18:04
sedera-tax
<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
<div class="container topnav">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@sedera-tax
sedera-tax / Random Quotes Button.markdown
Created December 28, 2015 18:45
Random Quotes Button
@sedera-tax
sedera-tax / currency.php
Created February 2, 2016 10:34
Currency converter api
<?php
function convertCurrency($amount, $from, $to){
$url = "https://www.google.com/finance/converter?a=$amount&from=$from&to=$to";
$data = file_get_contents($url);
preg_match("/<span class=bld>(.*)<\/span>/",$data, $converted);
$converted = preg_replace("/[^0-9.]/", "", $converted[1]);
return round($converted, 3).' '.$to;
}
echo convertCurrency(1000, "USD", "MGA");
@sedera-tax
sedera-tax / index.html
Created February 4, 2016 12:22
simpleWeather.demo.js v3.1.0
<!-- Docs at http://http://simpleweatherjs.com -->
<div class="row">
<div class="col-md-6">
<div id="weather"></div>
</div>
<div class="col-md-6">
<div id="weatherParis"></div>
</div>
</div>
@sedera-tax
sedera-tax / function.js
Created February 19, 2016 16:46
Make a function that looks through an array of objects (first argument) and returns an array of all objects that have matching property and value pairs (second argument). Each property and value pair of the source object has to be present in the object from the collection if it is to be included in the returned array.
function where(collection, source) {
var arr = [];
// What's in a name?
var n=0;
var l = Object.keys(source);
var nb = l.length;
for(var j in collection){
var res = 0;
for (var i in source) {
function myReplace(str, before, after) {
var test = before.slice(0,1);
var testMaj = test.toUpperCase();
if(test === testMaj){
after = after.charAt(0).toUpperCase() + after.substring(1).toLowerCase();
}
str = str.replace(before, after);
return str;
}
@sedera-tax
sedera-tax / pigLatin.js
Created February 28, 2016 11:55
Translate the provided string to pig latin. Pig Latin takes the first consonant (or consonant cluster) of an English word, moves it to the end of the word and suffixes an "ay". If a word begins with a vowel you just add "way" to the end.
function translate(str) {
var length = str.length;
var tab = [];
for(var i=0; i<length; i++){
var first = str.charAt(i);
//voyelle
if(first === "a" || first === "e" || first === "i" || first === "o" || first === "u" || first === "y"){
if(i === 0){
str = str + "way";
}
@sedera-tax
sedera-tax / missingletters.js
Last active February 28, 2016 12:24
Missing letters. Find the missing letter in the passed letter range and return it. If all letters are present in the range, return undefined.
function fearNotLetter(str) {
var x = 0;
var res = 0;
for (var i=0; i<str.length; i++) {
var y = str.charCodeAt(i);
if(x !== 0){
if(y !== x+1){
res = x + 1;
break;
}
@sedera-tax
sedera-tax / Free Code Camp Weather App.markdown
Created March 14, 2016 12:15
Free Code Camp Weather App