Skip to content

Instantly share code, notes, and snippets.

View xtrasmal's full-sized avatar
🟢
--- 200 OK

Xander xtrasmal

🟢
--- 200 OK
View GitHub Profile
@xtrasmal
xtrasmal / create_icns.sh
Last active August 26, 2024 13:31
Create a .icns file and/or png placeholders. Uses imagick to create the placeholders.
#!/bin/bash
# Icons and names
ICONS=(
"icon_16x16.png:16x16"
"icon_16x16@2x.png:32x32"
"icon_32x32.png:32x32"
"icon_32x32@2x.png:64x64"
"icon_128x128.png:128x128"
"icon_128x128@2x.png:256x256"
@xtrasmal
xtrasmal / CreateDateDimensionTable.php
Created September 1, 2023 13:59
// Store dates and time into separate database tables and reference them // whenever you need to add a time or date field // Easy lookups
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Artisan;
class CreateDateDimensionTable extends Migration
{
/**
{
"preset": "laravel",
"rules": {
"array_indentation": true,
"array_syntax": true,
"assign_null_coalescing_to_coalesce_equal": true,
"binary_operator_spaces": true,
"blank_line_after_namespace": true,
"blank_line_after_opening_tag": true,
"blank_line_before_statement": true,
@xtrasmal
xtrasmal / clickable-grid.css
Created July 24, 2013 16:42
JS/HTML Clickable grid
.grid { margin:1em auto; border-collapse:collapse }
.grid td {
cursor:pointer;
width:30px; height:30px;
border:1px solid #ccc;
text-align:center;
font-family:sans-serif; font-size:13px
}
.grid td.clicked {
background-color:yellow;
@xtrasmal
xtrasmal / symfony.logrotate
Created June 11, 2015 13:14
logrotate symfony
# cd /etc/logrotate.d && touch symfony && nano symfony
/var/www/sitename/app/logs/dev.log {
monthly
missingok
rotate 4
compress
sharedscripts
copytruncate
size 100M
@xtrasmal
xtrasmal / 1.Directory_structure.js
Last active May 19, 2020 16:30
Use vuex all the time.. it's pretty simple to setup. NO SPA..cause.. yeah.. I dont like spa's
// Based on Laravel's base setup. This is the directory structure until the component
// later on, below this files, I'll show the contents of app.js and store.js
[assets]
|-- [sass]
|-- [js]
|-- app.js
|-- store.js
|-- setup.js
|-- [components]
@xtrasmal
xtrasmal / Chromium Mobile Device List
Created March 6, 2020 20:54 — forked from devinmancuso/Chromium Mobile Device List
Mobile Device Emulation List from Chromium
#Pulled from Chromium at: https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/devtools/front_end/toolbox/OverridesUI.js&q=WebInspector.OverridesUI._phones%20file:OverridesUI.js&sq=package:chromium&type=cs&l=310
#Phones
Define_phones = [
{deviceName: "Apple iPhone 3GS", width: 320, height: 480, deviceScaleFactor: 1, userAgent: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5", touch: true, mobile: true},
{deviceName: "Apple iPhone 4", width: 320, height: 480, deviceScaleFactor: 2, userAgent: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5", touch: true, mobile: true},
{deviceName: "Apple iPhone 5", width: 320, height: 568, deviceScaleFactor: 2, userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Versi
@xtrasmal
xtrasmal / JwtAuthController.php
Last active February 10, 2020 18:25
Vue auth + "tymon/jwt-auth": "^0.5.6"
<?php
namespace App\Http\Controllers\Auth;
use JWTAuth;
use App\Http\Controllers\Controller;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\Exceptions\TokenExpiredException;
use Tymon\JWTAuth\Exceptions\TokenInvalidException;
@xtrasmal
xtrasmal / angular-modular.js
Created June 23, 2013 02:32
Another way to get very modular
// Define all your modules with no dependencies
angular.module('DashboardApp', []);
angular.module('LoginApp', []);
angular.module('MenuApp', []);
angular.module('TwitterApp', []);
angular.module('MessageApp', []);
// Lastly, define your "main" module and inject all other modules as dependencies
angular.module('MainApp',
[
@xtrasmal
xtrasmal / controller.js
Last active December 1, 2019 23:28
Angular file upload directive/controller/server .. the server will never be used like that, because L4 is so fucking amazing
function Ctrl($scope, $http) {
//a simple model to bind to and send to the server
$scope.model = {
name: "",
comments: ""
};
//an array of files selected
$scope.files = [];