Skip to content

Instantly share code, notes, and snippets.

@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active November 2, 2024 12:56
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@pksunkara
pksunkara / config
Last active November 15, 2024 16:02
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = [email protected]
username = pksunkara
[init]
defaultBranch = master
[core]
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
@kingel
kingel / python2.4.rb
Last active September 26, 2015 15:58
homebrew python2.4 formula
require 'formula'
class Python24 <Formula
url 'http://www.python.org/ftp/python/2.4.6/Python-2.4.6.tgz'
homepage 'http://www.python.org/download/releases/2.4.6/'
md5 '7564b2b142b1b8345cd5358b7aaaa482'
depends_on 'gdbm' => :optional
depends_on 'readline'
@geddski
geddski / nesting.js
Created January 14, 2012 05:08
helper function for nesting backbone collections.
function nestCollection(model, attributeName, nestedCollection) {
//setup nested references
for (var i = 0; i < nestedCollection.length; i++) {
model.attributes[attributeName][i] = nestedCollection.at(i).attributes;
}
//create empty arrays if none
nestedCollection.bind('add', function (initiative) {
if (!model.get(attributeName)) {
model.attributes[attributeName] = [];
@P7h
P7h / IntelliJ_IDEA__Perf_Tuning.txt
Last active October 21, 2024 01:10
Performance tuning parameters for IntelliJ IDEA. Add these params in idea64.exe.vmoptions or idea.exe.vmoptions file in IntelliJ IDEA. If you are using JDK 8.x, please knock off PermSize and MaxPermSize parameters from the tuning configuration.
-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
@kkurni
kkurni / kk-example-angularjs-cors
Last active September 25, 2018 18:13
CORS Demo with Angular JS
var AngularJSApp = angular.module("AngularJSApp", ["ngResource", "ngSanitize"])
.config(function ($routeProvider, $httpProvider) {
$routeProvider.
when('/', { controller: NavigationCtrl, templateUrl: 'navigation.html' }).
when('/feedback', { controller: FeedbackCtrl, templateUrl: 'feedback.html' }).
otherwise({ redirectTo: '/' });
$httpProvider.defaults.withCredentials = true;
delete $httpProvider.defaults.headers.common["X-Requested-With"];
@dodyg
dodyg / gist:5823184
Last active October 20, 2024 12:25
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@kroger
kroger / mobi.py
Created June 26, 2013 11:37
Mobi builder based on Sphinx's epub builder.
# -*- coding: utf-8 -*-
"""
sphinx.builders.mobi
~~~~~~~~~~~~~~~~~~~~
Build mobi files.
Originally derived from epub.py.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
@mariuszprzydatek
mariuszprzydatek / SSLCertificateValidation.java
Last active February 3, 2023 10:28
mariuszprzydatek.com blog example on how to disable SSL certificate validation in Java
package my.hydepark.ssl;
import javax.net.ssl.*;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
public class SSLCertificateValidation {
public static void disable() {
try {
@rob-murray
rob-murray / add_intellij_launcer
Last active October 21, 2024 14:30
Add Intellij launcher shortcut and icon for ubuntu
// create file:
sudo vim /usr/share/applications/intellij.desktop
// add the following
[Desktop Entry]
Version=13.0
Type=Application
Terminal=false
Icon[en_US]=/home/rob/.intellij-13/bin/idea.png
Name[en_US]=IntelliJ