Skip to content

Instantly share code, notes, and snippets.

View vishr's full-sized avatar
🎯
Focusing

Vishal Rana vishr

🎯
Focusing
View GitHub Profile
@dacodekid
dacodekid / index.html
Last active August 29, 2022 02:27
Hugo with Webpack Integration
<!-- refer generated css/js file -->
<link rel="stylesheet" href="{{$.Site.BaseURL}}/{{ if eq (getenv "APP_ENV") "dev" }}main.css{{ else }}{{ index .Site.Data.manifest "main.css" | relURL }}{{ end }}">
<script type="text/javascript" src="{{$.Site.BaseURL}}/{{ if eq (getenv "APP_ENV") "dev" }}main.js{{ else }}{{ index .Site.Data.manifest "main.js" | relURL }}{{ end }}"></script>
@brbsix
brbsix / README.md
Last active December 27, 2021 22:33
Networking Troubles with Vagrant Box ubuntu/wily64

Networking Troubles with Vagrant Box ubuntu/wily64

For some reason, the network interfaces in ubuntu/wily64 fail to configure at boot. The interfaces are renamed during boot, with dmesg reporting things like udev renamed network interface eth0 to enp1s0. This is apparently the result of a change in systemd. You can read about it here:

Starting with v197 systemd/udev will automatically assign predictable, stable network interface names for all local Ethernet, WLAN and WWAN interfaces. This is a departure from the traditional interface naming scheme ("eth0", "eth1", "wlan0", ...), but should fix real problems.

http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/


@larruda
larruda / unquoted_json_fix.js
Last active November 22, 2022 09:49
REGEX to add quotes to JSON unquoted keys (turns an invalid JSON into a valid one).
json_string.replace(/(\s*?{\s*?|\s*?,\s*?)(['"])?([a-zA-Z0-9]+)(['"])?:/g, '$1"$3":');
eval('var json = new Object(' + json_string + ')');
@TheNicholasNick
TheNicholasNick / 01 Install Arch Linux Guest on VirtualBox.md
Last active November 26, 2017 14:24
Simple to the point no fluff install Arch Linux Guest on VirtualBox
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active November 29, 2023 15:35
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@cobyism
cobyism / gh-pages-deploy.md
Last active May 6, 2024 08:07
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@tly1980
tly1980 / fabfile.py
Created November 27, 2012 01:56
Small demo to show how to use fabric & cuisine to do some DevOps
from fabric.api import env, local, sudo, cd
from fabric.contrib.files import append
from cuisine import user_ensure, group_ensure, group_user_ensure, file_local_read
from cuisine import select_package, package_update, package_ensure, dir_exists, run
from fabric.context_managers import prefix, settings
def vagrant():
# change from the default user to 'vagrant'
env.user = 'vagrant'
@aheckmann
aheckmann / emit.js
Created June 7, 2012 15:25
mongoose update,new,remove events
var mongoose = require('mongoose');
mongoose.connect('localhost', 'testing_emitUpdate');
var Schema = mongoose.Schema;
var schema = new Schema({
name: String
});
// plumbing
schema.pre('save', function (next) {
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@nicolasfont
nicolasfont / targznode
Created March 15, 2012 00:52
tar.gz with node.js
var fstream = require("fstream"),
tar = require("tar"),
zlib = require("zlib");
fstream.Reader("src").pipe(tar.Pack()).pipe(zlib.createGzip()).pipe(fstream.Writer("output.tar.gz"));