Skip to content

Instantly share code, notes, and snippets.

View ryonakae's full-sized avatar
🙄

Ryo Nakae ryonakae

🙄
View GitHub Profile
@EQuimper
EQuimper / useScrollRestoration.ts
Created September 20, 2020 01:31
NextJS save scroll position between page for back handler
import React from 'react';
import Router, { NextRouter } from 'next/router';
// Save the scroll position for the given url
function saveScrollPosition(
url: string,
element: HTMLElement,
savePosition: (url: string, pos: number) => void
) {
@claus
claus / _app.js
Created May 14, 2020 05:35
Restore scroll position after navigating via browser back/forward buttons in Next.js
import useScrollRestoration from "utils/hooks/useScrollRestoration";
const App = ({ Component, pageProps, router }) => {
useScrollRestoration(router);
return <Component {...pageProps} />;
};
export default App;
@pchw
pchw / .gitignore
Last active August 29, 2015 14:17 — forked from uzimith/gulpfile.js
node_modules
.DS_Store
template.js
bundle.js.map
bundle.js
index.html
lib
@k33g
k33g / index.html
Last active April 18, 2019 05:49
Vue.js + ES6
<div id="demo">
<h1>{{bob.fields.firstName}} {{bob.fields.lastName}}</h1>
</div>
<ul id="humans-list">
<li v-repeat="humans">
{{fields.firstName}} {{fields.lastName}}
</li>
</ul>

#How you get Sail.js running on Openshift#

This instruction is tested with:

  • Sails.js v0.9.16
  • Node.js 0.10 on Openshift ( 05 May 2014)

###1) package.json

If you use the package.json build by sails new Projectname than you have to add a few fields for openshift – so the server can start you app automatically. Sails uses Grunt to build minify css/js and so on. Openshift dont have grunt installed so you have to add this also.

@bamboo-c
bamboo-c / gulpfile.js
Last active August 29, 2015 14:07
gulpfile.js
"use strict";
// variables
var gulp = require("gulp");
var $ = require("gulp-load-plugins")();
var jade = require("gulp-jade");
var stylus = require("gulp-stylus");
var spritesmith = require("gulp.spritesmith");
var uglify = require("gulp-uglify");
var autoprefixer = require("gulp-autoprefixer");
@mgng
mgng / memop.js
Last active August 29, 2015 14:05
jquery memo
// 先頭セミコロンは直前のプログラムを明示的に終わらせるためのおまじないみたいなもんだから別にかかなくてもいい
;$(function(){
// 当然 use strict
'use strict';
// jQuery オブジェクトは $ を付けて他の変数と区別
var $name = $("#id_name");
var name = $name.val();
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active June 2, 2024 09:14
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
.xxx
+fontface('xxx', 'xxx/xxx-webfont')
font-family: 'xxx'
module Sass::Script::Functions
def file_exists(path)
return bool(false) unless options[:filename] # not all sass has a file name (e.g. std input)
current_directory = File.dirname(options[:filename]) rescue nil # a sass filename from an importer may not be processable by File.dirname
return bool(false) unless current_directory && File.exist?(current_directory) # not all sass files are served from the filesystem
full_path = File.expand_path(path.value, current_directory) # a relative path will be expanded against the current_directory of the sass file, symlinks will be followed, absolute paths will be left alone.
return bool(File.exist?(full_path))
end
end