Skip to content

Instantly share code, notes, and snippets.

View mtigdemir's full-sized avatar
🏠
Working from home

Muharrem Tigdemir mtigdemir

🏠
Working from home
View GitHub Profile
@mtigdemir
mtigdemir / laravel_one_to_one_profile
Created November 27, 2014 13:43
Laravel One to One Create
$user = User::find(10);
$profile = $user->UserProfile ?: new UserProfile;
$profile->name = 'Steven';
$user->UserProfile()->save($profile);
@mtigdemir
mtigdemir / Duplicate Clone Table MySQL.sql
Last active August 29, 2015 14:10
Duplicate Clone Table MySQL
CREATE TABLE table LIKE original_table;
INSERT INTO table SELECT * FROM original_table;
@mtigdemir
mtigdemir / servlettest.java
Last active August 29, 2015 14:10
Google App Engine Channel Servlet
package com.mtigdemir;
import java.io.IOException;
import javax.servlet.http.*;
import com.google.appengine.api.channel.ChannelMessage;
import com.google.appengine.api.channel.ChannelService;
import com.google.appengine.api.channel.ChannelServiceFactory;
@mtigdemir
mtigdemir / animation.js
Created February 10, 2015 10:05
Div ID Scroll Animation
$(document).on('click', 'a[href^="#"]', function(e) {
// target element id
var id = $(this).attr('href');
// target element
var $id = $(id);
if ($id.size() === 0) {
return;
}
$(document).ajaxStart(function () {
$(".loading").show();
});
$(document).ajaxComplete(function () {
$(".loading").hide();
});
// SET THE input old value with following values Input::old('key');
Session::set('_old_input.key', Input::get('value'));
.facebook{
color : #3b5998;
}
.twitter{
color : #00aced;
}
.google-plus{
color : #dd4b39;
}
.youtube{
$("#textarea").keyup(function(){
$("#count").text("Characters left: " + (500 - $(this).val().length));
});
$messageBag = new Illuminate\Support\MessageBag;
$messageBag->add('error' , 'My Message');
Redirect::back()->withErrors($messageBag);
Redirect::back()->with('tab' , 'tab-photos');