Skip to content

Instantly share code, notes, and snippets.

View mkv27's full-sized avatar
🎯
Focusing

Miguel Mendoza mkv27

🎯
Focusing
View GitHub Profile
// Use the new media manager to handle uploads to Soliloquy.
$('#soliloquy-area').on('click.soliloquyUpload', '#soliloquy-upload', function(e){
// Prevent the default action from occuring.
e.preventDefault();
// Variable to hold our media applicaton.
var soliloquy_frame;
// If the media frame already exists, reopen it and return.
if ( soliloquy_frame ) {
@mkv27
mkv27 / inread.js
Last active May 26, 2016 20:55
Create code inread
(function($){
var n = $( ".post-full_entry > p" ).length;
var nth = Math.floor(n/2)+1;
var sel = ".post-full_entry > p:eq("+(nth-1)+")";
sel = $(sel);
if(sel.height() == 20){
nth++;
sel = ".post-full_entry > p:eq("+(nth-1)+")";
sel = $(sel);
}
@mkv27
mkv27 / webpack.config.js
Created March 31, 2016 22:25 — forked from learncodeacademy/webpack.config.js
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@mkv27
mkv27 / json_postgres.js
Created May 12, 2017 15:10 — forked from lucdew/json_postgres.js
Example of json document storage in postgresql and querying (with knex.js)
var connectionString = 'postgres://localhost:5432/postgres';
var Promise=require('bluebird');
var knex = require('knex')({
client: 'pg',
connection: {
user: 'postgres',
database: 'postgres',
port: 5432,
@mkv27
mkv27 / easing.css
Created June 22, 2017 00:15 — forked from bendc/easing.css
Easing CSS variables
:root {
--ease-in-quad: cubic-bezier(.55, .085, .68, .53);
--ease-in-cubic: cubic-bezier(.550, .055, .675, .19);
--ease-in-quart: cubic-bezier(.895, .03, .685, .22);
--ease-in-quint: cubic-bezier(.755, .05, .855, .06);
--ease-in-expo: cubic-bezier(.95, .05, .795, .035);
--ease-in-circ: cubic-bezier(.6, .04, .98, .335);
--ease-out-quad: cubic-bezier(.25, .46, .45, .94);
--ease-out-cubic: cubic-bezier(.215, .61, .355, 1);
@mkv27
mkv27 / .gitignore
Created October 23, 2017 22:23
.gitignore
# dependencies
node_modules
# logs
npm-debug.log
yarn-error.log
# Nuxt build
.nuxt
@mkv27
mkv27 / demo.js
Created March 14, 2018 21:00 — forked from bambooom/demo.js
merge two arrays and remove duplicate in es6
let arr1 = [3, 5, 2, 2, 5, 5];
let arr2 = [2, 1, 66, 5];
let unique = [...new Set([...arr1,...arr2])];
console.log(unique);
// [ 3, 5, 2, 1, 66 ]
@mkv27
mkv27 / djb2.js
Created October 27, 2018 02:55 — forked from eplawless/djb2.js
function hash(str) {
var len = str.length;
var hash = 5381;
for (var idx = 0; idx < len; ++idx) {
hash = 33 * hash + str.charCodeAt(idx);
}
return hash;
}
@mkv27
mkv27 / Raw.swift
Created November 16, 2018 00:41 — forked from martijnwalraven/Raw.swift
Hacky way of getting a custom GraphQL scalar for raw JSON to work in Apollo iOS
typealias Raw = [String: JSONDecodable & JSONEncodable]
extension Dictionary: JSONDecodable {
public init(jsonValue value: JSONValue) throws {
guard let dictionary = forceBridgeFromObjectiveC(value) as? Dictionary else {
throw JSONDecodingError.couldNotConvert(value: value, to: Dictionary.self)
}
self = dictionary
}
}

Keybase proof

I hereby claim:

  • I am mkv27 on github.
  • I am mkv (https://keybase.io/mkv) on keybase.
  • I have a public key ASDJ2WE_DxdA_2OinSGgzsFkm135q1LqtGXyrM3yfXPvHQo

To claim this, I am signing this object: