Skip to content

Instantly share code, notes, and snippets.

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

Jonathan Samines jonathansamines

🏠
Working from home
View GitHub Profile
@jonathansamines
jonathansamines / AssemblyDirectory
Created July 8, 2013 18:19
Obtiene el directorio en donde un ensamblado está ejecutandose.
Public ReadOnly Property AssemblyDirectory() As String
Get
Dim codeBase As String = Assembly.GetExecutingAssembly().CodeBase
Dim uriBuilder As New UriBuilder(codeBase)
Dim assemblyPath As String = Uri.UnescapeDataString(uriBuilder.Path)
Return Path.GetDirectoryName(assemblyPath)
End Get
End Property
@jonathansamines
jonathansamines / EliminarProcesosExcel
Created August 21, 2013 19:58
Eliminar procesos de Excel
Dim proc As System.Diagnostics.Process
For Each proc In System.Diagnostics.Process.GetProcessesByName("EXCEL")
If proc.MainWindowTitle.Trim.Length = 0 Then
'proc.GetCurrentProcess.StartInfo
proc.Kill()
End If
Next
import Ember from 'ember';
export default Ember.Object.extend({
gtCountry: { code: 'GT', region: 'LATAM' },
usCountry: { code: 'US', region: 'NA' },
filterByRegion(region) {
// adiós al "arguments" objeto. No más conversiones a arrays!
const countries = Array.prototype.slice.call(arguments, 1);
const filtereCountries = countries.filter((country) => country.region === region);
@jonathansamines
jonathansamines / abilities.js
Created September 2, 2017 02:07
React Abilities
import { withAbility, provideSession } from ‘react-can’;
import SimpleMenu from ‘simple-menu’;
const entryAbilities = {
canWrite(session, props) {
return session.user.role === ‘ADMIN’;
},
canRead(session, props) {
return false;
}
@jonathansamines
jonathansamines / server.js
Created August 2, 2019 22:48
inversion-control
// initialize server
import Service from './service';
server.route({
method: 'GET',
config: {
handler() {
const service = new Service();
@jonathansamines
jonathansamines / withDebugEnabled.js
Created September 4, 2023 16:25
Next.js configuration middleware to enable source maps on server chunks
function withDebugEnabled(nextConfig) {
return {
...nextConfig,
webpack(conf, options) {
// eslint-disable-next-line no-param-reassign
if (options.isServer) conf.devtool = 'source-map';
// Overload the Webpack config if it was already overloaded
if (typeof nextConfig.webpack === 'function') {
return nextConfig.webpack(conf, options);