Skip to content

Instantly share code, notes, and snippets.

View isu3ru's full-sized avatar

Isuru Ranawaka isu3ru

  • Sri Lanka
  • 19:15 (UTC +05:30)
View GitHub Profile
@isu3ru
isu3ru / rotating_animation.css
Created September 28, 2017 21:03
Rotating ring
.gps_ring {
border: 3px solid #999;
-webkit-border-radius: 30px;
height: 32px;
width: 32px;
display: inline-block;
-webkit-animation: pulsate 1s ease-out;
-webkit-animation-iteration-count: infinite;
opacity: 0.0
}
@isu3ru
isu3ru / HtaccessSnippets.txt
Last active October 3, 2017 05:11
htaccess snippets
# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
Setting a rewrite rule in .htaccess: use cases
----------------------------------------------
NOTE: The directives specified below work under their own syntax. Changing any symbol or character can lead to improper function or failure of the rewrite rule. To keep things clear, we have highlighted those parts, which can be modified, with red color (mostly where a certain domain name should be placed).
Let’s take an overview of the most common situations in which a redirection from HTTP to HTTPS can be configured.
.presentation-title {
font-size: 8em;
font-weight: 700;
margin: 0;
color: #FFFFFF;
background: #fbf8ec;
background: -moz-linear-gradient(top, #FFFFFF 35%, #4e6773 100%);
background: -webkit-linear-gradient(top, #FFFFFF 35%, #4e6773 100%);
background: linear-gradient(to bottom, #FFFFFF 35%, #4e6773 100%);
background-clip: border-box;
<script type="text/javascript">
/* First CSS File */
var giftofspeed = document.createElement('link');
giftofspeed.rel = 'stylesheet';
giftofspeed.href = '../css/yourcssfile.css';
giftofspeed.type = 'text/css';
var godefer = document.getElementsByTagName('link')[0];
godefer.parentNode.insertBefore(giftofspeed, godefer);
/* Second CSS File */
@isu3ru
isu3ru / laravel-blade-cheetsheet.txt
Last active June 10, 2024 04:21
Commands for Laravel Blade template engine
{{ $var }} - Echo content
{{ $var or 'default' }} - Echo content with a default value
{{{ $var }}} - Echo escaped content
{{-- Comment --}} - A Blade comment
@extends('layout') - Extends a template with a layout
@if(condition) - Starts an if block
@else - Starts an else block
@isu3ru
isu3ru / hexAlphaCalculator.java
Created October 20, 2017 04:12
Java code to get each hexadecimal value from 100% to 0% alpha
for (double i = 1; i >= 0; i -= 0.01) {
i = Math.round(i * 100) / 100.0d;
int alpha = (int) Math.round(i * 255);
String hex = Integer.toHexString(alpha).toUpperCase();
if (hex.length() == 1)
hex = "0" + hex;
int percent = (int) (i * 100);
System.out.println(String.format("%d%% — %s", percent, hex));
}
<?php
function starsLineIcons($count = 1, $title = FALSE) {
echo '<span class="ratings ratings-golden"';
if (empty($title)) {
echo " title='{$title}'";
}
echo '>';
for ($i=0; $i < $count; $i++) {
echo '<span class="fa fa-star"></span>';
}
<?php
/**
* Replaces double line-breaks with paragraph elements.
*
* A group of regex replaces used to identify text formatted with newlines and
* replace double line-breaks with HTML paragraph tags. The remaining
* line-breaks after conversion become <<br />> tags, unless $br is set to '0'
* or 'false'.
*
* @param string $para The text which has to be formatted.
<select name="country" id="country">
<option value="0" label="Select a country … " selected="selected">Select a country</option>
<optgroup id="country-optgroup-Africa" label="Africa">
<option value="DZ" label="Algeria">Algeria</option>
<option value="AO" label="Angola">Angola</option>
<option value="BJ" label="Benin">Benin</option>
<option value="BW" label="Botswana">Botswana</option>
<option value="BF" label="Burkina Faso">Burkina Faso</option>
<option value="BI" label="Burundi">Burundi</option>
<option value="CM" label="Cameroon">Cameroon</option>
<select name="countries">
<option value="United States">United States</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Anguilla">Anguilla</option>