Skip to content

Instantly share code, notes, and snippets.

View dimasjt's full-sized avatar
🤓

Dimas J. Taniawan dimasjt

🤓
View GitHub Profile
@dimasjt
dimasjt / get_csrf_token_rails.js
Created February 25, 2016 04:01
get csfrf token with jquery for header
{ "X-CSRF-Token": $('meta[name="csrf-token"]').attr('content') }
@dimasjt
dimasjt / async.js
Last active March 1, 2016 09:08
function for async javascript or stylesheet
if(window.loaded_files == undefined){
window.loaded_files = {};
}
window.loadCSSAsync = function(path, name){
if(loaded_files[name] == undefined){
var cb = function() {
var l = document.createElement('link'); l.rel = 'stylesheet';
l.href = path;
var h = document.getElementsByTagName('head')[0]; h.parentNode.insertBefore(l, h);
};
@dimasjt
dimasjt / application.rb
Created April 6, 2016 04:29
Disable generate assets, helpers, view spec when running rails generate or scaffold
config.generators do |generate|
generate.helper false
generate.assets false
generate.view_specs false
generate.test_framework :rspec
generate.factory_girl dir: 'factories'
end
@dimasjt
dimasjt / config.cson
Created October 17, 2016 04:30
Configuration for Atom.io
"*":
"atom-material-ui":
colors:
abaseColor:
red: 96
green: 125
blue: 139
alpha: 1
genAccent: true
paintCursor: true
@dimasjt
dimasjt / .eslintrc.json
Last active June 15, 2017 02:48
My Config
{
"extends": "airbnb",
"plugins": [
"react",
"jsx-a11y",
"import"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
@dimasjt
dimasjt / .stylelintrc
Created August 29, 2017 04:06
stylelint configuration
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-selector-bem-pattern",
"@namics/stylelint-bem"
],
"rules": {
"max-nesting-depth": 1,
"comment-no-empty": true,
"declaration-no-important": true,
@dimasjt
dimasjt / trigger_react.jsx
Last active April 29, 2019 12:15
trigger event react
const e = new KeyboardEvent("keydown", {
bubbles : true,
cancelable : true,
shiftKey : true,
keyCode : 13
});
const input = document.querySelectorAll('input')[0]
input.dispatchEvent(e)
##Create a migration
### rails g migration make_unicode_friendly
class MakeUnicodeFriendly < ActiveRecord::Migration
def change
alter_database_and_tables_charsets "utf8", "utf8_general_ci"
end
private
def alter_database_and_tables_charsets charset = default_charset, collation = default_collation
@dimasjt
dimasjt / README.md
Created December 8, 2023 14:42
https SSL for Bun and NextJS. using proxy

PORT=3001 bun run dev & PORT=3000 bun run proxy.ts