Skip to content

Instantly share code, notes, and snippets.

👌
Enjoying life, including work.

Balint Erdi balinterdi

👌
Enjoying life, including work.
Block or report user

Report or block balinterdi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@balinterdi
balinterdi / bubblesort.lua
Created Jul 12, 2019
A highly efficient bubble sort algorithm in Lua
View bubblesort.lua
function print_array(a)
local i = 1
while a[i] do
print(a[i])
i = i + 1
end
end
function bubblesort(t)
local swapsMade;
@balinterdi
balinterdi / ember-font-awesome.ts
Last active Jul 3, 2019
First stab at Embroider compat-adapter for ember-font-awesome
View ember-font-awesome.ts
import V1Addon from '../v1-addon';
import { AddonMeta } from '@embroider/core';
export default class EmberFontAwesome extends V1Addon {
get packageMeta(): Partial<AddonMeta> {
let meta = super.packageMeta;
meta['public-assets'] = {
'node_modules/font-awesome/fonts/FontAwesome.otf': '/fonts/FontAwesome.otf',
};
for (let extension of ['eot', 'svg', 'ttf', 'woff', 'woff2']) {
@balinterdi
balinterdi / application.js
Created Jul 3, 2019
Setting document title in the application route
View application.js
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default Route.extend({
currentUser: service(),
router: service(),
init() {
this._super();
this.setDocumentTitle();
View id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAnMnNV3Wonaxa0BHY5gTelsUpet1qRfEhzJUGN04tD1gXXAZnF+iDBQcw7g7600MS0OsXbiquQYiyqEhnnLpUv4fMmN+aEoqh20+smU6iKbHN2RwXwb7NRQ6kzHyQD+QC+/6MJjOsdjCibLmljMwGUh1MKw+AQ248cooSJdpHKqs=
@balinterdi
balinterdi / ga-events.js
Created Mar 4, 2016
Prevent GA to report too high of a bounce rate for your "one page at one visit" site (a landing page or a blog)
View ga-events.js
$.domReady(function(){
// Fire an event so that GA doesn't count it as a "bounce"
// http://blog.popcornmetrics.com/why-your-google-analytics-bounce-rate-is-wrong-and-how-to-fix-it/
function readPage() {
ga('send', {
'hitType': 'event',
'eventCategory': 'engagement',
'eventAction': 'read'
});
}
View ethers
0x1E65F71b024937b988fdba09814d60049e0Fc59d
@balinterdi
balinterdi / copy-text-to-clipboard.js
Created Jul 27, 2017
Copy some text to the clipboard using the brower's DOM API
View copy-text-to-clipboard.js
export default function copyTextToClipboard(text) {
let textArea = document.createElement("textarea");
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
try {
// Now that we've selected the anchor text, execute the copy command
let successful = document.execCommand('copy');
let message = successful ? 'successful' : 'unsuccessful';
@balinterdi
balinterdi / settings.json
Created May 26, 2017
My VSCode configuration
View settings.json
{
"window.zoomLevel": 1,
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/tmp": true,
"node_modules": true, // this excludes the folder
// only from the root of
// your workspace
"tmp": true,
@balinterdi
balinterdi / router.js
Created Apr 25, 2017
Log in in a modal (lightbox), without the page "underneath" disappearing
View router.js
Router.map(function() {
this.route('about-us', function() {
this.route('login', { path: '/' }); // or you can even have a different path if you don't mind the URL change
});
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
You can’t perform that action at this time.