Skip to content

Instantly share code, notes, and snippets.

jQuery(document).ready(function($){
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
if (agentID) {
// mobile code here
}
});
@adamwathan
adamwathan / belongs-to-many.sublime-snippet
Last active August 3, 2024 16:44
Eloquent Relationship snippets for Sublime Text
<snippet>
<content><![CDATA[
public function ${1:relationship}()
{
return \$this->belongsToMany(${1/^(.+)$/(?1\u$1:)/g}::class, {$2:table});
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>belt</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@JeffreyWay
JeffreyWay / .vimrc
Created January 28, 2016 05:18
Laracasts: Vim Mastery - Episode 3 .vimrc progress
syntax enable
colorscheme desert
"-------------General Settings--------------"
set backspace=indent,eol,start "Make backspace behave like every other editor.
let mapleader = ',' "The default leader is \, but a comma is much better.
set number "Let's activate line numbers.
@apat
apat / nav_laravel.blade.php
Last active March 20, 2021 19:50
Menu Navigation Active Class - Laravel 4.x
<!-- Active navigation links to the menu -->
<nav>
<ul>
<!-- First active class -->
<li class="{{ Request::is( '/') ? 'active' : '' }}">
<a href="{{ URL::to( '/') }}">Home</a>
</li>
<li class="{{ Request::is( 'about-us') ? 'active' : '' }}">
<a href="{{ URL::to( 'about-us') }}">About us</a>
</li>
@james-d
james-d / application.css
Last active May 14, 2023 10:58
Example of using Bindings (extensively) for validation in JavaFX. Maybe a basis for thinking about a validation framework.
.root {
error-color: #ffa0a0 ;
}
.text-field:validation-error {
-fx-background-color: error-color ;
}
.label.error-instructions {
-fx-text-fill: error-color ;
}
@denji
denji / README.md
Last active February 11, 2025 10:01 — forked from istepanov/gist:3950977
Remove/Backup – settings & cli for macOS (OS X) – DataGrip, AppCode, CLion, Gogland, IntelliJ, PhpStorm, PyCharm, Rider, RubyMine, WebStorm
@jewelsea
jewelsea / Main.java
Last active January 12, 2025 06:21
Small JavaFX framework for swapping in and out child panes in a main FXML container. Code is for Java 8+.
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import java.io.IOException;
/**
* Main application class.
@Daniel15
Daniel15 / 1_README.md
Last active March 22, 2025 04:24
Complete Google Drive File Picker example

Google Drive File Picker Example

This is an example of how to use the Google Drive file picker and Google Drive API to retrieve files from Google Drive using pure JavaScript. At the time of writing (14th July 2013), Google have good examples for using these two APIs separately, but no documentation on using them together.

Note that this is just sample code, designed to be concise to demonstrate the API. In a production environment, you should include more error handling.

See a demo at http://stuff.dan.cx/js/filepicker/google/

@jrfnl
jrfnl / wp-config-debug.php
Last active March 13, 2025 10:13
Code to add to wp-config.php to enhance information available for debugging.
<?php
/**
* == About this Gist ==
*
* Code to add to wp-config.php to enhance information available for debugging.
*
* You would typically add this code below the database, language and salt settings
*
* Oh.. and *do* make sure you change the path to the log file to a proper file path on your server (make sure it exists).
*
@jewelsea
jewelsea / PopupExample.java
Created February 27, 2012 18:50
JavaFX Popup example
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Popup;
import javafx.stage.Stage;