Skip to content

Instantly share code, notes, and snippets.

@movii
movii / main.js
Last active November 28, 2017 09:22
笔记:使用 JavaScript 识别文件 MIME TYPE 类型:2. 对比文件类型的操作
FR.onload = (e) {
let af = e.target.result
, view = new DataView(af)
, first4Byte = view.getUint32(0, false);
let hexValue = Number(first4Byte).toString(16);
switch (hexValue) {
case 'FFD8FFE0':
case 'FFD8FFE1':
@jherax
jherax / arrayFilterFactory.1.ts
Last active February 20, 2025 05:05
Filters an array of objects with multiple match-criteria.
type FilterOperator = 'AND' | 'OR';
type FiltersBy<T> = {
[K in keyof T]?: (value: T[K]) => boolean;
};
/**
* Factory function that creates a specialized function to filter
* arrays, by validating all filters (AND operator),
* or validating just one of the filters (OR operator).
* @param operator Method to validate all filters: AND, OR
@jwalton512
jwalton512 / admin(v2).js
Last active May 15, 2018 19:41
Harmony with Laravel + Vue + Vue Router
// dashboard component
var dashboard = Vue.extend({
template: '<p>Hello from dashboard</p>'
})
// user management component
var user = Vue.extend({
template: '<p>Hello from user management page</p>'
})
@afutseng
afutseng / gist:bdd58d8e28e7a2444a25
Last active August 29, 2015 14:27
COSCUP 2015 Hands-on MySQL 入門 by gslin 筆記
https://github.com/gslin/coscup2015-mysql-hands-on
開場
# Transaction
## 原子不可分割性
要碼全部成功不然就全部失敗 - 銀行轉帳 (林益世 v.s. 陳啟祥)
持久性 (D)
@jaceju
jaceju / ExampleTest.php
Last active August 29, 2015 14:26
Auth Unit Testing
<?php
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Auth;
class ExampleTest extends TestCase
{
/**
* DatabaseTransactions :在測試其間對資料庫的所有操作會在測試完成後被滾回
@nkbt
nkbt / .eslintrc.js
Last active April 1, 2025 03:07
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@jaceju
jaceju / web_development_with_laravel_5.md
Last active November 1, 2024 08:20
Laravel 5 測試起手式

Web Development with Laravel 5

目標

如何在開發的過程中加入測試。

  1. Model
  2. Repository
  3. Controller
  4. Auth
@amochohan
amochohan / 01_Laravel 5 Simple ACL manager_Readme.md
Last active March 21, 2025 14:47
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

Disclaimer: This is an unofficial post by a random person from the community. I am not an official representative of io.js. Want to ask a question? open an issue on the node-forward discussions repo

io.js - what you need to know

io-logo-substack

  • io is a fork of node v0.12 (the next stable version of node.js, currently unreleased)
  • io.js will be totally compatible with node.js
  • the people who created io.js are node core contributors who have different ideas on how to run the project
  • it is not a zero-sum game. many core contributors will help maintain both node.js and io.js
@donnierayjones
donnierayjones / LICENSE
Last active June 24, 2024 14:28
Render Bootstrap as "small" layout when printing
Copyright (C) 2016 Donnie Ray Jones
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions: