Skip to content

Instantly share code, notes, and snippets.

View andres-torres-marroquin's full-sized avatar
🎯
Focusing

Andrés Torres Marroquín andres-torres-marroquin

🎯
Focusing
View GitHub Profile
class CacheBooleanField(serializers.BooleanField):
EXPIRES = 3600 * 24 * 30
def field_from_native(self, data, files, field_name, into):
result = super(CacheBooleanField, self).field_from_native(
data, files, field_name, into
)
value = into.get(field_name, self.default)
cache.set(self.get_key(), value, self.EXPIRES)
return result
# Original Idea: http://djangosnippets.org/snippets/2124/
from functools import wraps
from django.db.models.signals import pre_save
from django.db.models.signals import post_save
from django.db.models.signals import pre_delete
from django.db.models.signals import post_delete
from django.db.models.signals import m2m_changed
def autoconnect(cls):
"""
curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | env REUSE_XP="no" IEVMS_VERSIONS="8" bash

Setup Finder

defaults write com.apple.finder ShowPathbar -bool true
defaults write com.apple.finder ShowTabView -bool true 
defaults write com.apple.finder ShowStatusBar -bool true
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
killall Finder

Install zsh

window.addSnapScroll = ($element) ->
width_of_two_columns = 550 # (Width of column 270 + padding of column 10) * 2 - 10
data = {}
$element.bind 'touchstart', (e) ->
if document.width > width_of_two_columns
return
page_x = e.originalEvent.touches[0].pageX
page_y = e.originalEvent.touches[0].pageY
$this = $ this
@andres-torres-marroquin
andres-torres-marroquin / 1-Hackintosh.md
Last active July 19, 2019 23:46
Hackintosh ROG Strix Z270I macOS Sierra 10.12.6
# reference: https://github.com/github/gemoji/blob/master/db/emoji.json
module.exports = [
['😀', 0, 'grinning']
['😃', 0, 'smiley']
['😄', 0, 'smile']
['😁', 0, 'grin']
['😆', 0, 'laughing, satisfied']
['😅', 0, 'sweat_smile']
{
Platform
} = require 'react-native'
getBottomTabsHeight = ->
if Platform.OS is 'android'
return 56
if Platform.OS is 'ios'
return if isIphoneX() then 84 else 50
useForceUpdate = -> useState()[1]
useDebouncedForceUpdate = _.debounce useForceUpdate, 100
useCollectionBinder = (collection) ->
forceUpdate = useForceUpdate()
useEffect ->
collection.on 'add remove sort reset', forceUpdate
@andres-torres-marroquin
andres-torres-marroquin / 1-High-Sierra-Hackintosh.md
Last active April 26, 2020 19:14
Hackintosh ROG Strix Z270I macOS High Sierra 10.13.6