Skip to content

Instantly share code, notes, and snippets.

View sasknot's full-sized avatar
:octocat:

Rafael Silva sasknot

:octocat:
View GitHub Profile
@sasknot
sasknot / css_grayscale.css
Last active August 29, 2015 14:00
CSS Grayscale
/* Apply the effect */
img.grayscale {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
filter: gray; /* IE6-9 */
-webkit-filter: grayscale(100%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */
}
/* Disable the effect */
@sasknot
sasknot / js_basics.md
Last active November 3, 2021 20:16
Javascript basics

Primary Data Types

  • String
  • Number
  • Boolean

Composite Data Types

  • Object
  • Array
@sasknot
sasknot / script
Created July 2, 2014 20:00
Commom select2 types
(function($){
'use strict';
$.fn.applySelect2 = function() {
this.filter('.select2-no-search').each(function(){
var options = $(this).data('options') || {};
$.extend( options, { minimumResultsForSearch: -1 } );
$(this).data('options', options);
@sasknot
sasknot / prevent-scroll.coffee
Last active February 4, 2016 07:23
Prevent scroll
# Functions to disable/enable scroll
scrollPreventDefault = (e) ->
e = e or window.event
if e.preventDefault
e.preventDefault()
e.returnValue = false
keydown = (e) ->
t = [37,38,39,40]
@sasknot
sasknot / index.js
Created March 23, 2020 14:55
JS: Remove chars from ending
output.split('').slice(0, -3).join('') + '.000'
Ex:
'1000000'.split('').slice(0, -3).join('') + '.000' // 1000.000
'100000'.split('').slice(0, -3).join('') + '.000' // 100.000
'10000'.split('').slice(0, -3).join('') + '.000' // 10.000
@sasknot
sasknot / script.ts
Last active November 3, 2021 16:09
AWS Lambda Invoking (aws-sdk v2)
import AWSLambda from 'aws-sdk/clients/lambda'
import { mode, modeIsDev } from '@/environment'
import type AWSSES from 'aws-sdk/clients/ses'
const lambda = new AWSLambda({
endpoint: modeIsDev ? 'http://localhost:3002' : undefined
})
const response = await lambda.invoke({
FunctionName: `myApi-${mode}-email`,
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@sasknot
sasknot / script.ts
Created November 18, 2021 19:56
Get X.509 Certificate SHA-1 Thumbprint (nodejs)
import crypto from 'crypto'
const x509Certificate = '[insert certificate here]'
const certificateStrings = x509Certificate.match(/-----BEGIN CERTIFICATE-----\s*([\s\S]+?)\s*-----END CERTIFICATE-----/i)
if (certificateStrings && certificateStrings[1]) {
throw new Error('Invalid certificate')
}
const sha1Thumbprint = crypto
export PATH=~/.npm-global/bin:$PATH
export PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin:$PATH"
export PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin:$PATH"
alias ll='ls -lh'
alias dockerps="docker ps -a --format \"table {{.ID}}\t{{.Image}}\t{{.RunningFor}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}\""
eval "$(/opt/homebrew/bin/brew shellenv)"
@sasknot
sasknot / navicat_reset_trial.sh
Created December 14, 2022 17:13 — forked from tuxity/navicat_premium_reset_trial.sh
Reset Navicat Premium 15/16 remaining trial days
#!/bin/bash
set -e
file=$(defaults read /Applications/Navicat\ Premium.app/Contents/Info.plist)
regex="CFBundleShortVersionString = \"([^\.]+)"
[[ $file =~ $regex ]]
version=${BASH_REMATCH[1]}