Skip to content

Instantly share code, notes, and snippets.

Val Neekman un33k

Block or report user

Report or block un33k

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
View SassMeister-input.scss
// ----
// libsass (v3.3.2)
// ----
$spacer: 1rem;
$spacer-x: $spacer;
$spacer-y: $spacer;
$spacers: ();
@un33k
un33k / walksync.js
Created Mar 7, 2018 — forked from kethinov/walksync.js
List all files in a directory in Node.js recursively in a synchronous fashion
View walksync.js
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@un33k
un33k / simple_args_parsing.sh
Created Mar 5, 2018 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
View simple_args_parsing.sh
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
View Nativescript String to Base64 String and Vice-Versa.ts
/*
* Convert A String to Base64 String or Vice-Versa
*/
declare const android: any;
declare const java: any;
declare const NSData: any;
declare const NSUTF8StringEncoding: any;
declare const NSString: any;
@un33k
un33k / psql-with-gzip-cheatsheet.sh
Created Oct 5, 2017 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
View psql-with-gzip-cheatsheet.sh
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@un33k
un33k / translateLSLoader.ts
Last active Jan 26, 2017 — forked from ocombe/translateLSLoader.ts
ng2-translate file loader with localstorage to speed up things
View translateLSLoader.ts
import {TranslateLoader} from "ng2-translate/ng2-translate";
import {Observable} from "rxjs/Observable";
import {Response, Http} from "angular2/http";
export class TranslateLSLoader implements TranslateLoader {
constructor(private http: Http, private prefix: string = 'i18n', private suffix: string = '.json') {}
/**
* Gets the translations from the localStorage and update them with the ones from the server
* @param lang
@un33k
un33k / authentication.ts
Created Dec 14, 2016 — forked from btroncone/authentication.ts
Angular 2 application role access decorator, wrapping built in CanAccess functionality. Prevents view transitions when user roles are not appropriate.
View authentication.ts
import { Injectable } from 'angular2/core';
import { Storage } from './storage';
import { CurrentUser } from '../interfaces/common';
@Injectable()
export class Authentication{
private _storageService : Storage;
private _userKey : string = "CURRENT_USER";
constructor(storageService : Storage){
@un33k
un33k / osx-pdf-from-markdown.markdown
Created Nov 14, 2016 — forked from georgiana-gligor/osx-pdf-from-markdown.markdown
Markdown source for the "Create PDF files from Markdown sources in OSX" article
View osx-pdf-from-markdown.markdown

Create PDF files from Markdown sources in OSX

When [Markdown][markdown] appeared more than 10 years ago, it aimed to make it easier to express ideas in an easy-to-write plain text format. It offers a simple syntax that takes the writer focus away from the formatting, thus giving her time to focus on the actual content.

The market abunds of editors to be used for help with markdown. After a few attempts, I settled to Sublime and its browser preview plugin, which work great for me and have a small memory footprint to accomplish that. To pass the results around to other people, less technical, a markdown file and a bunch of images is not the best approach, so converting it to a more robust format like PDF seems like a much better choice.

[Pandoc][pandoc] is the swiss-army knife of converting documents between various formats. While being able to deal with heavy-weight formats like docx and epub, we will need it for the more lightweight markdown. To be able to generate PDF files, we need LaTeX. On OSX, the s

@un33k
un33k / hash-object.js
Created Nov 2, 2016 — forked from colelawrence/hash-object.js
Create an md5 hash string of a javascript object using crypto createHash, update, and digest hex
View hash-object.js
var crypto = require('crypto');
exports.hashObject = function (object) {
var hash = crypto.createHash('md5')
.update(JSON.stringify(object, function (k, v) {
if (k[0] === "_") return undefined; // remove api stuff
else if (typeof v === "function") // consider functions
return v.toString();
else return v;
}))
@un33k
un33k / autoscaling_boto.py
Created Jan 18, 2016 — forked from numan/autoscaling_boto.py
Example of setting up AWS auto scaling using boto API
View autoscaling_boto.py
"""
The MIT License (MIT)
Copyright (c) 2011 Numan Sachwani
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
You can’t perform that action at this time.