Skip to content

Instantly share code, notes, and snippets.

View DevotionGeo's full-sized avatar
🏡
Working from home

Bangash DevotionGeo

🏡
Working from home
View GitHub Profile
@DevotionGeo
DevotionGeo / .zshrc
Last active March 3, 2024 11:49
Alias `rails` to `bin/rails` only inside a Rails directory
# Alias `rails` to `bin/rails` only inside a Rails directory
rails() {
if [ -n "$(find . -maxdepth 1 -name bin -type d -exec test -e '{}/rails' ';' -print -quit)" ] && [ -e Gemfile ]; then
bin/rails "$@"
else
command rails "$@"
fi
}
@DevotionGeo
DevotionGeo / styles.css
Created August 15, 2020 02:05
Stylus Styles for code snippets on Learning.Oreilly
table.processedcode, #sbo-rt-content .codeline, #sbo-rt-content .codeinfo {
font-family: Iosevka, 'Ubuntu Mono', monospace !important;
letter-spacing: 0.2px;
}
.scalefonts #sbo-rt-content td {
font-size: 17px !important;
}
#sbo-rt-content .string {
font-style: normal;
}
@DevotionGeo
DevotionGeo / material-design-breakpoints.css
Created June 26, 2018 13:15 — forked from eyecatchup/material-design-breakpoints.css
CSS media queries based on the breakpoint guidance published by the Material Design team. http://www.google.com/design/spec/layout/adaptive-ui.html#adaptive-ui-breakpoint
/* Material Design Adaptive Breakpoints */
/*
Below you'll find CSS media queries based on the breakpoint guidance
published by the Material Design team. You can choose to use, customise
or remove these breakpoints based on your needs.
http://www.google.com/design/spec/layout/adaptive-ui.html#adaptive-ui-breakpoints
*/
/* mobile-small */
@DevotionGeo
DevotionGeo / getActiveMQ.js
Created June 27, 2017 03:59 — forked from aarongustafson/getActiveMQ.js
A simple way to track media query use in your JavaScript
// Get the active Media Query as defined in the CSS
// Use the following format:
// #getActiveMQ-watcher { font-family: "default"; }
// @media only screen and (min-width:20em){ #getActiveMQ-watcher { font-family: "small"; } }
// etc.
window.getActiveMQ = function() {
// Build the watcher
var $watcher = document.createElement('div'),
// alias getComputedStyle
computed = window.getComputedStyle,
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"caret_extra_bottom": 3,
"caret_extra_top": 3,
"caret_extra_width": 1,
"caret_style": "phase",
"color_scheme": "Packages/Base16 Color Schemes/Themes/base16-google-light.tmTheme",
"font_size": 14,
"gutter": true,
@DevotionGeo
DevotionGeo / Default (OSX).sublime-keymap.txt
Created March 16, 2017 17:36
Sublime-emmet-jsx-tab-expand
[
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
@DevotionGeo
DevotionGeo / gist:4744cfcd3700c2ac93fb
Last active November 11, 2015 18:51
Custom validation rule in CodeIgniter
<?php
class Something extends CI_Controller {
# some code
/**
* Full Name Check, custom validation rule
* How to use? : $this->form_validation->set_rules('fullName', 'Full Name', 'required|callback_fullname_check');
*/
<script>
// test for localStorage support
if(('localStorage' in window) && window['localStorage'] !== null){
var f = document.getElementById('mainform');
// test with PHP if the form was sent (the submit button has the name "sent")
<?php if(isset($_POST['sent']))){?>
// get the HTML of the form and cache it in the property "state"
localStorage.setItem('state',f.innerHTML);
<?php
/**
* Return the value for a key in an array or a property in an object.
* Typical usage:
*
* $object->foo = 'Bar';
* echo get_key($object, 'foo');
*
* $array['baz'] = 'Bat';
* echo get_key($array, 'baz');