Skip to content

Instantly share code, notes, and snippets.

Avatar

inoas

View GitHub Profile
View Git checkout remote branch
//To fetch a branch, you simply need to:
git fetch origin
//This will fetch all of the remote branches for you. With the remote branches
//in hand, you now need to check out the branch you are interested in, giving
//you a local working copy:
git checkout -b test origin/test
@inoas
inoas / PHPtoICS.php
Created Jan 9, 2017 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
View PHPtoICS.php
<?php
// Variables used in this script:
// $summary - text title of the event
// $datestart - the starting date (in seconds since unix epoch)
// $dateend - the ending date (in seconds since unix epoch)
// $address - the event's address
// $uri - the URL of the event (add http://)
// $description - text description of the event
// $filename - the name of this file for saving (e.g. my-event-name.ics)
//
View use-cakephp3-view-template-anywhere.php
<?php
$xmlView = new XmlView;
$xmlView->templatePath = 'Service';
$xmlView->template = 'api.xml'; // Template/Service/xml/api.xml.ctp
$xmlView->set('foo', 'bar');
var_dump($xmlView->render());
@inoas
inoas / IsUniqueInContext.php
Created Mar 8, 2017
CakePHP3 IsUniqueInContextRule
View IsUniqueInContext.php
<?php
namespace App\Model\Rule;
use Cake\Datasource\EntityInterface;
use Cake\ORM\TableRegistry;
/**
* Checks if a list of fields from an entity are unique in the table given a context where they can be duplicates
*/
class IsUniqueInContext
@inoas
inoas / brew-perms.sh
Created Jun 30, 2017 — forked from jaibeee/brew-perms.sh
Configure homebrew permissions to allow multiple users on MAC OSX. Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
View brew-perms.sh
#!/bin/sh
# Configure homebrew permissions to allow multiple users on MAC OSX.
# Any user from the admin group will be able to manage the homebrew and cask installation on the machine.
# allow admins to manage homebrew's local install directory
chgrp -R admin /usr/local
chmod -R g+w /usr/local
# allow admins to homebrew's local cache of formulae and source files
chgrp -R admin /Library/Caches/Homebrew
@inoas
inoas / .eslintrc.js
Created Sep 1, 2017 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
View .eslintrc.js
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@inoas
inoas / fontStacks.css
Created Nov 23, 2017 — forked from kkemple/fontStacks.css
Font Stacks with all browser based fonts
View fontStacks.css
/* Times New Roman-based stack */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
/* Modern Georgia-based serif stack */
font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif;
/* Traditional Garamond-based serif stack */
font-family: "Palatino Linotype", Palatino, Palladio, "URW Palladio L", "Book Antiqua", Baskerville, "Bookman Old Style", "Bitstream Charter", "Nimbus Roman No9 L", Garamond, "Apple Garamond", "ITC Garamond Narrow", "New Century Schoolbook", "Century Schoolbook", "Century Schoolbook L", Georgia, serif;
/* Helvetica/Arial-based sans serif stack */
@inoas
inoas / clean-install-high-sierra-apfs.md
Created Dec 21, 2017 — forked from galderz/clean-install-high-sierra-apfs.md
How To Clean Install High Sierra on APFS-formatted main HD
View clean-install-high-sierra-apfs.md

Clean Install High Sierra on APFS-formatted main HD

Installation Steps

  1. From 10.11 or 10.12 systems, format an external hard drive with at least 500gb with "Mac Os Extended Journaled".
  2. Download High Sierra Beta and install it in the external hard drive.
  3. When the system reboots and finishes installation, it will boot from the external HD. Go to Preferences and change Startup Disk to be main HD.
  4. Reboot and press Option key when the computer makes a beep and select external HD to boot from it.
  5. Once booted again into external HD, format main HD to be APFS.
@inoas
inoas / object-watch.js
Created Jan 16, 2018 — forked from flackjap/object-watch.js
Fork of object.watch polyfill in ES5. Modified to not react when the value set is the same as previous.
View object-watch.js
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
*
* Modified by Nenad Damnjanović
* Nov 9, 2014
@inoas
inoas / stripNamespaceFromClassName.php
Created Mar 2, 2018 — forked from jasondmoss/stripNamespaceFromClassName.php
Strip the namespace from the class to get the actual class name
View stripNamespaceFromClassName.php
<?php
/**
* Strip the namespace from the class to get the actual class name
*
* @param string $obj Class name with full namespace
*
* @return string
* @access public
*/