Posts

JS-Sass-@if AND @else

These are my Sass trials at FreeCodeCamp @ If, @ else statement is the same as the logic in other programming languages. < style type = 'text/sass' > @mixin border-stroke($val){ @if $val ==light {border: 1px solid black;} @else if $val ==medium {border: 3px solid black;} @else if $val ==heavy {border: 6px solid black;} @else {border: none;} /*If value doesn't come*/ } #box { width: 150px; height: 150px; background-color: red; @include border-stroke(medium);/*We gave a value with @include*/ } </ style > < div id = "box" ></ div >

Bootstrap : img-responsive

Image
Bootstrap img-responsive WellComeBack Click here for bootstrap . You can set perfectly fit width of your page with img-responsive . Codes in the page ----------------------------------------------- " " .red-text { color: red; } h2 { font-family: Lobster, Monospace; } p { font-size: 16px; font-family: Monospace; } .thick-teal-border { border-color: teal; border-width: 10px; border-style: solid; border-radius: 50%; } .smaller-image { width: 100px; } WellComeBack Click here for bootstrap . You can set perfectly fit width of your page with img-responsive . Things bootstrap: bad useful perfect Bootstrap for design inappropriate so so wonderful Submit Things bootstrap: bad useful perfect Bootstrap for design inappropriate so so wonderful Submit

Javascript >> Add Methods After Inheritance

A constructor function that inherits its  prototype   object from a  supertype   constructor function can still have its own methods in addition to inherited methods. For example, BlogRecord is a constructor that inherits its prototypefrom Record: function Record() { } Record.prototype.oldRecord= function () { console.log( "old record" ); }; function BlogRecord() { } BlogRecord.prototype = Object.create(Record.prototype); BlogRecord.prototype.constructor = BlogRecord; BlogRecord.prototype.newRecord= function (){console.log( "new record" );} let record= new BlogRecord(); record.oldRecord(); record.newRecord();

Javascript >> Reset an Inherited Constructor Property

When an object inherits its  prototype  from another object, it also inherits the  supertype 's constructor property. For example: function Blogger() { } Blogger .prototype = Object.create(BloggerClass.prototype); let myBlog= new Blogger(); myBlog.constructor // function BloggerClass(){...} You can manually set Blogger's constructor property to the Blogger object. Blogger .prototype.constructor =  Blogger ; myBlog .constructor // function  Blogger (){...}

Arrow Functions - Javascript

                                           If the entered number is even number add 1.  var h = [2,8,12,47];  var f=h.filter(x=> x%2==0).map(y=>y+1); In here, filter() does logical processing and map() function do addition process. Other example containing test(),replace() functions. const myReplace=str1=>{ "use strict"; const chStr=/old/; const myString="My old friend is very clever."; return chStr.test(myString) ? myString.replace(chStr,str1) : NaN; }; print(myReplace("best")); ----Old output---- My old friend is very clever. ---New output--- My best friend is very clever.

Python Rabin-Miller Algoritması İle Asallık Testi

#Bu yazıyı çeviri olarak yazıyorum, kod kaynağı aşağıdaki sitede bir kitapta yer alıyor. #Birkaç satırı gerektiği için ekledim. from __future__ import print_function # Rabin-Miller Algoritması İle Asallık Testi. # http://inventwithpython.com/hacking (BSD Licensed) import random def rabinMiller(num):     #Sayımız eğer asalsa True döner     s=num-1     t=0     while s%2==0:         s=s//2 # s bitene kadar yarısını alacağız.         t +=1  # t'yi tutma nedeni ise s'nin kaç kere 2'ye bölünüdüğünü tutmak istememizdir.     for trials in range(5): #num değerinin asallığını 5 defa yanlışlamaya çalışacağız.         a=random.randrange(2,num-1)         v=pow(a,s,num)         if v!=1: # v, 1'e eşitse çalışmayacak             i=0             while v !=(num-1):  ...

Personal Encryption with Python

Image
import random: Bizim için rasgele oluşturulacak olayları yapabilmeyi sağlayan kaynak. .txt : Bu txt uzantılı dosyalar değişiklikleri kaydedip görebileceğimiz yerler.Erişimi ve değişiklikleri en kolay bu dosyalarda yapabiliyoruz.       Yaptığım bu küçük kod parçasında alınan verileri boyutlarına göre sıraladım.Onları parça parça (dizi olduğu için iş kolay oldu) istediğim yerlere yerleştirdim.Bu arada random.choice(".....") ile içerisine rastgele seçilen karakterleri de yerleştirdim. a : Kullandığımız dosyaya ekleme işlemi yapar(append). write() : Dosyaya veri yazmak için kullanılır.