Skip to content

Instantly share code, notes, and snippets.

@mayinx
mayinx / media-query.css
Created December 21, 2017 10:32 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
  • Dynamic Dispatch
  • Dynamic Method
  • Ghost Methods
  • Dynamic Proxies
  • Blank Slate
  • Kernel Method
  • Flattening the Scope (aka Nested Lexical Scopes)
  • Context Probe
  • Class Eval (not really a 'spell' more just a demonstration of its usage)
  • Class Macros
@mayinx
mayinx / rails-4-concern.sublime-snippet
Created October 5, 2018 11:03 — forked from xiy/rails-4-concern.sublime-snippet
A sublime text editor snippet to quickly create a new Rails Concern
<snippet>
<content><![CDATA[module ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}}
extend ActiveSupport::Concern
included do
$2
end
end]]></content>
<tabTrigger>mod</tabTrigger>
<scope>source.ruby, source.ruby.rails, source.rails</scope>
@mayinx
mayinx / ruby-benchmarking.sh
Last active January 23, 2020 20:42
Easy Ruby-Benchmarking
# Easy Ruby-Benchmarking, e.g
require 'benchmark'
n = 10_000
Benchmark.bm do |benchmark|
benchmark.report("settings") do
n.times do
d.settings(:themes).value
# in .bahrc replace this:
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
@mayinx
mayinx / _base.css
Last active July 9, 2021 10:30
webprojects-utilities
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
font-size: 16px;
@mayinx
mayinx / axios-catch-error.js
Created October 26, 2021 15:43 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨