Skip to content

Instantly share code, notes, and snippets.

@abdullah353
abdullah353 / 0_reuse_code.js
Created February 7, 2014 12:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@abdullah353
abdullah353 / laravel_model
Created March 5, 2014 07:04
Deafult Values In laravel Model
class MyModel extends Eloquent {
protected $attributes = array(
'field' => 'default',
'field2' => 'default2',
);
}
@abdullah353
abdullah353 / laravel_globalUserView.php
Created March 6, 2014 05:45
Share Variable with all views: Now I have access to the currently logged in user as $user in all views, and can access anything from it as normal, such as $user->email
class BaseController extends Controller
{
public function __construct()
{
// Fetch the User object, or set it to false if not logged in
if (Sentry::check()) {
$user = User::find(Sentry::getUser()–>id);
}
else {
$user = false;
@abdullah353
abdullah353 / flex_boilerplate.html
Created March 7, 2014 10:42
Basic Flex Example
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.flex
{
/* basic styling */
width: 350px;
height: 200px;
import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_highgui.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
public class circleDetection{
public static void main(String[] args){
IplImage src = cvLoadImage("img2.png");
IplImage gray = cvCreateImage(cvGetSize(src), 8, 1);
cvCvtColor(src, gray, CV_BGR2GRAY);
Form::file('file[]', array('multiple'=>true));
//or:
<input multiple="1" name="file[]" type="file">
//Or for older browsers:
<input name="file[]" type="file">
<input name="file[]" type="file">
<input name="file[]" type="file">
<?php
Illuminate\Routing\UrlGenerator
__construct(RouteCollection $routes, Request $request) Both parameter ar from Symfony
full() // Get the full URL for the current request.
current() // Get the current URL for the request.
previous() // Get the URL for the previous request.
to($path, $parameters = array(), $secure = null) // Generate a absolute URL to the given path.
secure($path, $parameters = array()) // Generate a secure, absolute URL to the given path.
asset($path, $secure = null) // Generate a URL to an application asset.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#!/usr/bin/php
<?php
class AsyncOperation extends Thread {
public function __construct($arg) {
$this->arg = $arg;
}
public function run() {
if ($this->arg) {
@abdullah353
abdullah353 / curl_replicate.sh
Created September 7, 2014 17:07
Couchdb Replicate Design Document Only by using curl
curl -X POST -H "Content-Type:application/json" -d '{"target":"http://youruser:yourpassword@yourserver/tangerine","source":"http://youruser:yourpassword@yourserver/tangerine","doc_ids": ["_design/tangerine"]}' http://youruser:yourpassword@yourserver/_replicate