Skip to content

Instantly share code, notes, and snippets.

View dragonfire1119's full-sized avatar
😲
Turning ideas into reality!

Christopher dragonfire1119

😲
Turning ideas into reality!
View GitHub Profile
/*
* Adapted from: http://code.google.com/p/gaequery/source/browse/trunk/src/static/scripts/jquery.autogrow-textarea.js
*
* Works nicely with the following styles:
* textarea {
* resize: none;
* transition: 0.05s;
* -moz-transition: 0.05s;
* -webkit-transition: 0.05s;
* -o-transition: 0.05s;
@dragonfire1119
dragonfire1119 / app.js
Last active December 17, 2015 04:19
Angularjs transfer data to another controller. Found this on stack overflow saved me hours of looking.
angular.module('myApp.services', [])
.service('emailService', function ($rootScope){
var text = 'start value';
return {
saveEmail:function (data){
text = data;
$rootScope.$broadcast('new_message');
},
getEmail:function (){
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
/* The Grid ---------------------- */
.lt-ie9 .row { width: 940px; max-width: 100%; min-width: 768px; margin: 0 auto; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row.large-collapse .column,
.lt-ie9 .row.large-collapse .columns { padding: 0; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row .row.large-collapse { margin: 0; }
.lt-ie9 .column, .columns { float: left; min-height: 1px; padding: 0 15px; position: relative; }
.lt-ie9 .column.large-centered, .columns.large-centered { float: none; margin: 0 auto; }
<?php
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated with https://github.com/barryvdh/laravel-ide-helper
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
*/
namespace {
die('Only to be used as an helper for your IDE');
}
<?php
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated with https://github.com/barryvdh/laravel-ide-helper
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
*/
namespace {
die('Only to be used as an helper for your IDE');
}
@dragonfire1119
dragonfire1119 / calculating.php
Last active December 18, 2015 17:38
This is to help people with calculating time. It's not a perfect example but it gets to the point. Hope it helps somebody :)
<?php
$a = '1371688131';
$b = time();
$diff = ($b - $a);
if ($diff/60 > 30) {
echo "This is over 30 minutes";
} else {
echo "This is " . $diff/60 . " minutes";
}
if ($success)
{
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=success.php">';
exit;
}
else
{
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=retry.php">';
exit;
}
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';