Skip to content

Instantly share code, notes, and snippets.

View ndunk28's full-sized avatar
🏠
Working from home

Hendra Lindung S ndunk28

🏠
Working from home
View GitHub Profile
@ndunk28
ndunk28 / mixins.scss
Last active March 26, 2022 12:51
mixins
@mixin clearfix() {
&:after {
content: " ";
display: table;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
@ndunk28
ndunk28 / simple-parallax.css
Last active August 25, 2017 04:41
Simple Parallax using jquery
.parallax {
background-image: url('http://via.placeholder.com/1600x800');
background-position: top center;
background-repeat: no-repeat;
background-size: 100% auto;
}
@ndunk28
ndunk28 / application_helper.rb
Last active August 18, 2017 04:01
simple active menu rails
def current_class?(test_path)
request.path == test_path ? 'active' : ''
end
@ndunk28
ndunk28 / slick-on-mobile.js
Last active March 10, 2022 18:31
slick js only on mobile
// slider
$slick_slider = $('.slider');
settings_slider = {
dots: false,
arrows: false
// more settings
}
slick_on_mobile( $slick_slider, settings_slider);
// slick on mobile
@ndunk28
ndunk28 / ajax.js
Created September 15, 2017 15:08
Simple ajax data
$.ajax({
type: 'GET',
dataType: 'json',
url: "example.html",
data: {table:"id"},
beforeSend:function(a){
$("body").append("<p>beforesend</p>");
},
success: function (data) {
$("ul").append("<p>alreadysend</p>");
@ndunk28
ndunk28 / news.json
Last active November 23, 2017 05:20
Dummy Data JSON
"news":
[
{
"id" : "1",
"date":"September 2017" ,
"header":"Some news 1" ,
"content":"Text 1"
},
{
"id" : "2",
@ndunk28
ndunk28 / SCSS.md
Created April 17, 2018 07:32 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@ndunk28
ndunk28 / routerTestUtil.js
Created April 22, 2021 07:52
routerTestUtil.js
import React from "react";
import { Router } from "react-router-dom";
import { createStore } from "redux";
import { Provider } from "react-redux";
import { render, wait } from "@testing-library/react";
import { createMemoryHistory } from "history";
function renderWithRouter(ui, { route = "/", ...renderOptions } = {}) {
const history = createMemoryHistory({ initialEntries: [route] });
const utils = render(<Router history={history}>{ui}</Router>, renderOptions);