Skip to content

Instantly share code, notes, and snippets.

@hashrock
hashrock / vuejs.md
Last active October 5, 2023 23:42
Vue.js資料まとめ(古いので注意)

#まず見るべき

以下のURLは、常に更新されているコンテンツです。

@koistya
koistya / App.js
Last active June 8, 2022 09:55
How to add `onscroll` event in ReactJS component
import React from 'react';
let lastScrollY = 0;
let ticking = false;
class App extends React.Component {
componentDidMount() {
window.addEventListener('scroll', this.handleScroll, true);
}
@ecasilla
ecasilla / Mock Module
Created November 13, 2014 19:30
Node Mock Module Loader
var vm = require('vm');
var fs = require('fs');
var path = require('path');
/**
* Helper for unit testing:
* - load module with mocked dependencies
* - allow accessing private state of the module
*
* @param {string} filePath Absolute path to module (file to load)
@jackgris
jackgris / config.fish
Last active April 13, 2019 13:48
Example of config for fish shell
## Lenguaje Go
set --export GOROOT /usr/local/go
set -gx PATH /usr/local/go/bin $PATH
#set -gx PATH GOROOT/bin $PATH
set --export GOPATH $HOME/GoProjects
set -gx PATH $GOPATH/bin $PATH
## AppEngine para GO
set -gx PATH $HOME/programs/go_appengine $PATH
@geckotang
geckotang / Gruntfile.js
Created October 2, 2014 12:35
UTF-8のSCSSファイルからCSSを生成して、ファイルエンコーディングをShift_JISに変換する
module.exports = function(grunt){
var path = require('path');
var matchdep = require('matchdep');
matchdep.filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
dev: {
@zeusdeux
zeusdeux / compose.js
Last active December 25, 2019 04:04
Functional programming toolkit for javascript
//this function composes functions like in Haskell (and most other functional languages)
//the final composed function can accept parameters dictated by the chain it creates
//you can pass it a list of functions and it shall apply them from RIGHT to LEFT (right associativeness?)
//eg., c0(fn1, fn2, fn3)(10) => return fn1(fn2(fn3(10)));
// out<---<----<----<=10
function c0(f, g) {
var last;
if (!arguments.length) return;
if (arguments.length === 1) return f;
if (arguments.length === 2) {
@sugarmo
sugarmo / find-unused-images
Created January 17, 2014 09:29
Find unused images
#!/bin/bash
# Escape code
esc=`echo -en "\033"`
# Set colors
cc_red="${esc}[0;31m"
cc_green="${esc}[0;32m"
cc_yellow="${esc}[0;33m"
cc_blue="${esc}[0;34m"
@tcnksm
tcnksm / docker_cheat.md
Last active January 14, 2025 15:09 — forked from wsargent/docker_cheat.md
Docker 虎の巻

Docker 虎の巻

何故Dockerを使うべきか

Why Should I Care (For Developers)

"Dockerが面白いのはシンプルな環境に隔離性と再現性をもたらしてくれることだ.ランタイムの環境を一度作れば、パッケージにして別のマシンでも再利用することできる.さらに,すべてはホスト内の隔離された環境で行われる(VMのように).最も素晴らしい点は,シンプルかつ高速であることだ."

@tecking
tecking / setup.sh
Last active December 27, 2015 16:49
WordPress installation script using WP-CLI (require: Vagrant and VVV (Varying Vagrant Vagrants) ).
#!/bin/sh
#
# Enter arguments.
#
echo "Enter some arguments for installation."
while true; do
echo -n "Target directory? (e.g., /vagrant/www/foo) : "
@mindscratch
mindscratch / fake_server.js
Last active July 13, 2018 05:56
Fake server-side using [Sinon.JS](http://sinonjs.org/). Inspiration from this [presentation](http://emdin.info/r/sinon-talk/).
var srv = sinon.fakeServer.create();
srv.autoRespond = true; // server should automatically respond after a timeout
srv.autoRespondAfter = 500; // response timeout in milliseconds
srv.xhr.useFitlers = true; // tell Sinon that some requests should not be faked
// add a filter that will tell Sinon to allowa all requests to access the server
// except fitlers defined when calling Server#fake.
srv.xhr.addFilter(function(method, url, async, username, password) {
var fakedRequest = _.find(Server.fakedRequests, function(request) {
return request.method === method && request.regex.test(url);