Skip to content

Instantly share code, notes, and snippets.

View felixjung's full-sized avatar

Felix Jung felixjung

View GitHub Profile
@felixjung
felixjung / snakeToCamelCase.js
Created October 23, 2015 10:04
ES6 module to recursively convert snake case keys in an object to camel case using lodash.
'use strict';
import 'lodash';
export default function (object) {
let camelCaseObject = _.cloneDeep(object);
// Convert keys to camel case
camelCaseObject = _.mapKeys(camelCaseObject, (value, key) => {
return key.replace(/(_\w)/, match => match[1].toUpperCase());
@felixjung
felixjung / index.js
Created June 13, 2018 06:04
Next.js testing circuit production build
import { ThemeProvider } from 'emotion-theming';
import { Text, Heading } from '@sumup/circuit-ui';
import { standard } from '@sumup/circuit-ui/themes';
export default () => <ThemeProvider theme={standard}><div>
<Heading>Hello</Heading>
<Text>Welcome to Next.js</Text>
</div></ThemeProvider>
@felixjung
felixjung / javascript-es2015.snippets
Created December 3, 2015 14:58
Some ES2015 snippets for UltiSnips
extends javascript
priority -60
snippet imp "import { ... } from ..." b
import ${1:\{ ${2:export} \}} from '${0:library}';
endsnippet
snippet impl "import * as ... from ..." b
import * as ${1:alias} from '${0:library}';
@felixjung
felixjung / gist:4130276
Created November 22, 2012 09:47
Print example for TM2. Selecting the second line _only_ and choosing "Run selection" from the menu will still run both lines.
print("Foo")
print("Bar")
@felixjung
felixjung / gist:4130245
Created November 22, 2012 09:37
R Bundle "Run" Code
if [ ! -z "$TM_INPUT_START_LINE" ]; then
if [ `echo -en "$TM_SELECTED_TEXT" | egrep -cv '^[ ]*#'` -gt 0 ]; then
echo -en "$TM_SELECTED_TEXT" | "$TM_BUNDLE_SUPPORT/tmR.rb" "$CRAN" 1
else
cat | "$TM_BUNDLE_SUPPORT/tmR.rb" "$CRAN" 0
fi
else
cat | "$TM_BUNDLE_SUPPORT/tmR.rb" "$CRAN" 0
fi
@felixjung
felixjung / gist:3842148
Created October 5, 2012 20:22
TM2 Gutter Keys
Further improvements to theming the gutter. There are now the following keys which can be set to change the color of gutter elements: Dennis Vennink
gutterDivider: Border between text view and gutter.
gutterForeground: Text color.
gutterBackground: Background color.
gutterIcons: Color of the images in the gutter.
gutterSelectionForeground: Text color for lines containing caret / part of a selection.
gutterSelectionBackground: Background color for lines containing caret / part of a selection.
gutterSelectionIcons: Color of images on lines containing caret / part of a selection.
gutterSelectionBorder: Border between selected and non-selected lines.
allan: I've almost fixed the LaTeX Watch
command in the latex.tmbundle. One issue
is left, after opening the document in the
viwer, the latex_watch.pl script fails to
kill the progress window opened using
CocoaDialog.
the progress bar dialog is created this
way:
https://gist.github.com/3361804
latex_watch.pl tries to kill it this way:
if (defined ($progressbar_pid)) {
kill(15, $progressbar_pid) or fail("Failed to close progress bar window: $!");
undef $progressbar_pid;
}
nice -n 20 CocoaDialog progressbar --indeterminate --title 'LaTeX Watch' --text 'LaTeX Watch: Compiling document' </dev/console &>/dev/null &
progressbar_pid=$(jobs -p %%)
disown %%
if(placeOnRight)
[layoutView addResizeInfo:(OakResizeInfo){ 11, 15, OakResizeInfo::kTopLeft, OakResizeInfo::kWidth } forView:fileBrowser.view];
else [layoutView addResizeInfo:(OakResizeInfo){ -11, 15, OakResizeInfo::kTopRight, OakResizeInfo::kWidth } forView:fileBrowser.view];