This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@ changing values like 'hi this is my first gist' to 'Hi This Is My First Gist'; | |
function changeAllToCaps(string){ | |
return (string.split(' ').map(function(x){ | |
x = x.charAt(0).toUpperCase() + x.slice(1); | |
return x ; | |
})).reduce(function(sum,value){ | |
return sum+' '+value; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var is_chrome = navigator.userAgent.indexOf('Chrome') > -1; | |
var is_explorer = navigator.userAgent.indexOf('MSIE') > -1; | |
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1; | |
var is_safari = navigator.userAgent.indexOf("Safari") > -1; | |
var is_opera = navigator.userAgent.toLowerCase().indexOf("op") > -1; | |
if ((is_chrome)&&(is_safari)) { is_safari = false; } | |
if ((is_chrome)&&(is_opera)) { is_chrome = false; } | |
//@ Or for Safari only | |
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {alert('Its Safari');} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-app="vkApp"> | |
<div ng-controller="vkController"> | |
<vk></vk> | |
<div compile="data.article"></div> | |
</div> | |
</div> | |
<script> | |
angular.module('vkApp', []); | |
angular.module('vkApp') | |
.controller('vkController', ['$scope', '$compile', function ($scope, $compile) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@ https://stackoverflow.com/questions/25095863/how-to-detect-file-extension-with-javascript-filereader | |
var fileTypes = ['jpg', 'jpeg', 'png', 'what', 'ever', 'you', 'want']; //acceptable file types | |
function readURL(input) { | |
if (input.files && input.files[0]) { | |
var extension = input.files[0].name.split('.').pop().toLowerCase(), //file extension from input file | |
isSuccess = fileTypes.indexOf(extension) > -1; //is extension in acceptable types | |
if (isSuccess) { //yes | |
var reader = new FileReader(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- taken from --> | |
<!-- http://www.rssheap.com/article/?p=YXJ0aWNsZWlkPTE3MjkyMTUmdGFiPXdlZWsmZ3VpZD1mMDRhNDZiZDRiOTY0ZDMxYWJhNDkyZGQ3OWE2YzQ2ZSZmaWx0ZXI9 --> | |
<!-- @demo --> | |
<!-- https://jsfiddle.net/cferdinandi/mqwwpL6u/ --> | |
<style> | |
textarea { | |
min-height: 5em; | |
max-height: 50vh; | |
width: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function showTime(){ | |
let todayDate = new Date(), | |
hour = todayDate.getHours(), | |
mins = todayDate.getMinutes(), | |
sec = todayDate.getSeconds() ; | |
const amPm = hour>=12 ? 'PM' : 'AM' ; | |
//12 hours format | |
hour = hour % 12 || 12 ; |