Skip to content

Instantly share code, notes, and snippets.

Avatar

Bernhard Döbler bardware

View GitHub Profile
View filesize_helper.js
Ember.Handlebars.helper('filesize', function(value) {
if (typeof value === 'undefined') {
return null;
}
var i,
filesize,
units = ['B', 'KB', 'MB', 'GB', 'TB'];
for (i = 0; i < units.length; i++) {
if (value < 1024) {
filesize = Math.floor(value) + units[i];
@bardware
bardware / SortableBindingList.vb
Created Mar 18, 2016 — forked from wcabus/SortableBindingList.vb
SortableBindingList is a list that supports sorting its items and filtering them.
View SortableBindingList.vb
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Reflection
Imports System.Linq
Imports System.Linq.Dynamic
''' <summary>
''' SortableBindingList is a list that supports sorting its items and filtering them.
''' When binding a <see cref="System.Collections.Generic.List(Of T)"/> to a <see cref="System.Windows.Forms.DataGridView"/>, you can not sort by clicking on the columns
''' or filter the list. With this list, you can.
@bardware
bardware / .eslintrc
Created Jun 4, 2016 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
View .eslintrc
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@bardware
bardware / stacktrace.log
Created Jun 24, 2016
An internal error occurred during: "Requesting JavaScript AST from selection".
View stacktrace.log
java.lang.ClassCastException: org.eclipse.wst.jsdt.internal.core.dom.binding.FunctionBinding cannot be cast to org.eclipse.wst.jsdt.core.dom.IVariableBinding
at org.eclipse.wst.jsdt.core.dom.BindingResolverDom.resolveVariable(BindingResolverDom.java:245)
at org.eclipse.wst.jsdt.core.dom.VariableDeclaration.resolveBinding(VariableDeclaration.java:198)
at org.eclipse.wst.jsdt.internal.ui.search.OccurrencesFinder.visit(OccurrencesFinder.java:228)
at org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment.accept0(VariableDeclarationFragment.java:224)
at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2426)
at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2499)
at org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement.accept0(VariableDeclarationStatement.java:320)
at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2426)
at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2499)
View update_msys2.sh
#!/bin/bash
# https://msys2.github.io/
# pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime-devel msys2-runtime
# pacman -Syu
# https://sourceforge.net/p/msys2/wiki/MSYS2%20installation/
# Since pacman 5.0.1.6403, you can just
# Run **`pacman -Syuu`**. Follow the instructions. Repeat this step until it says there are no packages to update.
pacman -Syuu
View woff2_compile.sh
LFLAGS="-static-libstdc++ -static-libgcc" CXXFLAGS="-static-libgcc -static-libstdc++" CC="gcc -Wall" make clean all V=1
View clean_msys2.sh
# Inspired by https://wiki.filezilla-project.org/wiki/index.php?title=Compiling_FileZilla_3_under_Windows&redirect=no
# pthread tendy to link dynamically, I prefer it statically linked
# Fix missing platform prefix for windres
[ -f /mingw64/bin/x86_64-w64-mingw32-windres.exe ] || ln -s /mingw64/bin/windres.exe /mingw64/bin/x86_64-w64-mingw32-windres.exe
[ -f /mingw32/bin/i686-w64-mingw32-windres.exe ] || ln -s /mingw32/bin/windres.exe /mingw32/bin/i686-w64-mingw32-windres.exe
# Even when statically linking to libstdc++, it still tries to dynamically link to lib(win)pthread. On top of it, libtool is too
# stupid to recognize the semantics of -Wl,-Bstatic. This leaves one option: Removing the dynamic import libraries.
rm /mingw32/i686-w64-mingw32/lib/libpthread.dll.a
rm /mingw32/i686-w64-mingw32/lib/libwinpthread.dll.a
@bardware
bardware / Exception Stack Trace
Last active Mar 16, 2017
Unhandled event loop exception
View Exception Stack Trace
org.eclipse.swt.SWTException: Failed to execute runnable (java.util.ConcurrentModificationException)
at org.eclipse.swt.SWT.error(SWT.java:4533)
at org.eclipse.swt.SWT.error(SWT.java:4448)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4211)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3827)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
View MyTest.cfm
<cfset test = new MyTest() />
<cfset test.newMethod() />
View MyTest.cfc
component accessors="true" {
property name="privateVarOne" default="privateVarOne default";
function init() {
return this;
}
public void function newMethod() {
var myVar = variables.privateVarOne;