Skip to content

Instantly share code, notes, and snippets.

@barryvdh
barryvdh / _ide_helper.php
Last active December 16, 2024 10:25
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@willurd
willurd / web-servers.md
Last active July 18, 2025 18:46
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@clochix
clochix / casperCookies.js
Created July 10, 2013 16:48
Sample cookies management with CasperJS: functions to load cookies from a Netscape formatted file and save them
/**
* Load cookies from a file
*
* @param {String} file name of da file.
*
* @return {Array} of cookies.
*/
function loadCookies(file) {
"use strict";
var cookies = [];
@nessthehero
nessthehero / boilerplate2.js
Last active December 21, 2015 08:58
Boilerplate.js version 2
// Do everything in a closure, so we don't affect or create any globals.
(function( $, window, document, undefined ) {
"use strict";
var Project = Project || {};
Project.init = function () {
@ravinsharma12345
ravinsharma12345 / customcms
Last active December 21, 2015 08:58
Some guide to creating a custom cms
/front-end(publicly visible area)
/admin area(management area)
non-cms, client request url from web server, web server sees if requested file exists, and if it does, it returns it. Very simple. Url is tied closely to the web page
THE FRONT-END AREA
cms(database backend cms, non-database backend cms). url does not exactly correspond directly to files on a server. Instead of creating webpages as files, it is better to use a "controller" to read from a database, based on what the URL was. There is a popular programming pattern called MVC, which is very similar in principle to what a CMS of this type does.
THE ADMIN AREA
@jasonlewis
jasonlewis / create-project.sh
Last active January 25, 2025 20:13
Bash script that creates a new project and virtual host for that project. Can also be used to quickly create a new Laravel project.
#!/bin/bash
# This script creates a new project (or site) under /var/sites and creates
# new virtual host for that site. With the options a site can also
# install the latest version of Laravel directly.
# This script was originally based on the following script by @Nek from
# Coderwall: https://coderwall.com/p/cqoplg
# Display the usage information of the command.
create-project-usage() {
@mickaelandrieu
mickaelandrieu / install.sh
Last active December 21, 2015 13:29
Install phantomjs/casperjs on GNU/Linux (Stable)
#!/bin/bash
# `` sudo sh install.sh ``
# Stable environnement
# Important: use 'i686' instead of 'x86_64'
# For Development environnement see also : https://gist.github.com/mickaelandrieu/6312683
echo Installation de Phantomjs
cd /usr/local/share
sudo wget https://phantomjs.googlecode.com/files/phantomjs-1.8.2-linux-x86_64.tar.bz2
@erikroyall
erikroyall / evento.js
Last active September 23, 2016 17:03
A cross-browser event handling system
// Evento - v1.0.0
// by Erik Royall <[email protected]> (http://erikroyall.github.io)
// Dual licensed under MIT and GPL
// Array.prototype.indexOf shim
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
'use strict';
@clochix
clochix / casperShell.js
Created October 8, 2013 09:37
Sample code to call a shell script from CasperJS
// (…)
var childProcess;
try {
childProcess = require("child_process");
} catch (e) {
this.log(e, "error");
}
if (childProcess) {
childProcess.execFile("/bin/bash", ["mycommand.sh", args1, args2, args3], null, function (err, stdout, stderr) {
this.log("execFileSTDOUT:", JSON.stringify(stdout), 'debug');
@etrepat
etrepat / traversing-example.md
Last active April 8, 2021 15:57
Traversing the Hierarchy Tree with Baum - An Example

The simplest way to traverse the hierarchy tree with Baum is by iterating through the children relation.

<?php

$root = Category::roots()->with('children')->first();

echo "<h3>{$root->name}</h3>";

foreach($root->children as $category) {