Skip to content

Instantly share code, notes, and snippets.

View ChristopherDosin's full-sized avatar
:octocat:
Out sick

Christopher Dosin ChristopherDosin

:octocat:
Out sick
View GitHub Profile
@foxted
foxted / .travis.yml
Last active June 8, 2022 13:36
Unit test Laravel 4.2 packages in context with Travis CI (with SQLite testing database)
language: php
php:
- 5.4
- 5.5
- 5.6
before_install:
- composer self-update
- composer create-project laravel/laravel
@hilios
hilios / README.md
Last active May 21, 2022 07:20
ngPageTitle - AngularJS page title service

$pageTitle

Allows to control the page title from the AngularJS route system, controllers or any other component through an injectable service.

ngPageTitle - Page title service (run tests)

To get started add the module to your app and configure the page title provider:

@tott
tott / ip_in_range.php
Created November 27, 2013 22:46
php check if IP is in given network range
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}
@JeffreyWay
JeffreyWay / example.html
Created August 16, 2013 17:53
Sometimes, when filtering through a collection and displaying them on the page, you need to wrap every X items within a wrapper. Common examples are when using Bootstrap... Is this the recommended way to do that? Fairly clean as it is, I guess...
@foreach(array_chunk($posts, 3) as $postSet)
<div class="row"> <!-- this div will surround every three posts -->
@foreach($postSet as $post)
<h3>{{ $post['title'] }}</h3>
@endforeach
</div>
@endforeach
@pjschreifels
pjschreifels / Margin Loop for LESS
Created June 29, 2013 23:32
#layout #less - Create top, right, bottom and left margin classes from 0px to 50px in 5px increments. Use as .mt_x, mb_x, mr_x, ml_x (top, bottom, right left margin, respectively), where x is a number from 0 to 50.
// Margin classes
// -------------------------
@from : 0;
@to : 50;
.loop(@index) when(@index =< @to) {
.mt_@{index} {
margin-top: unit(@index, px);
}
@sthamann
sthamann / OrderMod_Bootstrap.php
Last active March 19, 2021 12:14
Advanced Example how to create 2 custom fields, fill them in order process, display them in backend order list as new columns and make them editable in order detail view
<?php
class Shopware_Plugins_Frontend_OrderMod_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{
/**
* (non-PHPdoc)
* @see Shopware_Components_Plugin_Bootstrap::install()
*/
public function install()
{
@brandonheyer
brandonheyer / rgbToHSL.php
Last active June 12, 2021 06:49
PHP snippet to convert RGB to HSL and HSL to RGB.
<?
function rgbToHsl( $r, $g, $b ) {
$oldR = $r;
$oldG = $g;
$oldB = $b;
$r /= 255;
$g /= 255;
$b /= 255;
@barryvdh
barryvdh / _ide_helper.php
Last active April 4, 2024 09:11
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 <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@JeffreyWay
JeffreyWay / laravel.js
Last active April 6, 2024 20:12
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.) To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {
@jayj
jayj / flexbox.less
Last active November 20, 2023 04:51
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox