Skip to content

Instantly share code, notes, and snippets.

View rob1121's full-sized avatar

Robinson L. Legaspi rob1121

  • Cavite, Philippines
View GitHub Profile
@rob1121
rob1121 / app.blade.php
Last active July 13, 2016 07:47
HTTP POST laravel ajax request
{{-- place at your header meta tag --}}
<meta id="_token" value="{{ csrf_token() }}">
@rob1121
rob1121 / smoothScrolling.js
Created July 21, 2016 01:50
scroll smoothly
$('a[href^="#"]').bind('click.smoothscroll',function (e) {
e.preventDefault();
var anchor = this.hash,
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 500, 'swing', function () {
window.location.hash = anchor;
@rob1121
rob1121 / clean_inputs.php
Created July 21, 2016 01:54
clean inputs prior adding to database
<?php
function cleanInput($input) {
$search = array(
'@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments
);
@rob1121
rob1121 / blockqoutes.css
Created July 21, 2016 02:00
css Big Curly Blockquotes
blockquote {
position: relative;
text-indent: 2em;
}
.bqstart,
.bqend { font-size: 300%; }
/* apply IE specific rules first */
.bqstart {
@rob1121
rob1121 / mySqlDump.php
Created July 21, 2016 02:05
Creates a backup of a MySQL database in SQL format.
if (!function_exists('mysql_dump')) {
function mysql_dump($database) {
$query = '';
$tables = @mysql_list_tables($database);
while ($row = @mysql_fetch_row($tables)) { $table_list[] = $row[0]; }
for ($i = 0; $i < @count($table_list); $i++) {
@rob1121
rob1121 / scrollToTop.js
Created July 21, 2016 02:08
scroll to top using jquery
$('#someAnchor').click(function() {
$('html, body').animate({ scrollTop:0 }, 'fast');
return false;
});
@rob1121
rob1121 / phoneNumberfoarmat.php
Created July 21, 2016 02:11
using php format phone number
function format_phone($phone)
{
$phone = preg_replace("/[^0-9]/", "", $phone);
if(strlen($phone) == 7)
return preg_replace("/([0-9]{3})([0-9]{4})/", "$1-$2", $phone);
elseif(strlen($phone) == 10)
return preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "($1) $2-$3", $phone);
else
return $phone;
@rob1121
rob1121 / favicon
Created July 21, 2016 02:12
import favicon
<link rel="shortcut icon" href="favicon.ico" >
@rob1121
rob1121 / mouseWheelEvent.js
Created July 21, 2016 02:16
Mouse wheel programming in JavaScript
/*
* Author URL: http://adomas.org/javascript-mouse-wheel/
*/
/** This is high-level function.
* It must react to delta being more/less than zero.
*/
function handle(delta) {
if (delta < 0)
…;
@rob1121
rob1121 / copyright.php
Created July 21, 2016 02:17
footer copyright