Skip to content

Instantly share code, notes, and snippets.

@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active June 18, 2024 18:27
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
@johnnyreilly
johnnyreilly / PdfGenerator.cs
Created April 9, 2012 05:58
C# Wrapper for WKHTMLtoPDF
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Web;
using System.Web.Hosting;
namespace PdfGenerator
{
public class PdfGenerator
@simoncoulton
simoncoulton / nginx-uwsgi-python3
Created May 7, 2012 04:39
Setting up Nginx, uWSGI & Python3
======================================
Setting up Nginx, uWSGI and Python3
======================================
First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were:
1) Only showed you how to run the server for a single web application.
2) Only showed you how to configure the app, not the server it was running on.
My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me.
@jasny
jasny / image-embed-html.php
Created October 23, 2012 10:40
Create base64 encoded image to embed in HTML
<?php
$files = array_slice($argv, 1);
foreach ($files as $file) {
$picture = file_get_contents($file);
$size = getimagesize($file);
// base64 encode the binary data, then break it into chunks according to RFC 2045 semantics
$base64 = chunk_split(base64_encode($picture));
@schovi
schovi / api.js
Last active December 14, 2015 06:18
CanJS custom Api
// All calls reponses are converted into model instances or attributes are applied to current instance
var Api = can.Model('Api', {
callEndpoint: function(url) {
var ajax = this._ajax({}, url).call(this),
def = new can.Deferred(),
promise = def.promise(),
self = this;
promise.abort = ajax.abort
@jamesmbeams
jamesmbeams / gist:5155230
Created March 13, 2013 19:20
To allow Cordova (iOS) to connect to HTTPS with a self signed certificate, paste this at the bottom of AppDelegate.m NOTE: Only for testing, remember to remove it before submitting to the App Store, as I hear it could cause the app to be rejected.
@implementation NSURLRequest (ServiceClient)
+ (BOOL) allowsAnyHTTPSCertificateForHost:(NSString *) host
{
return YES;
}
@end
@3emad
3emad / summary.markdown
Last active December 15, 2015 17:19
AngularJS Practice Guide Summary

AngularJS Practice Guide Summary

  • Define and group Angular things (dependency injection stuff) in modules.
  • Share data and wrap web server interaction in services.
  • Extend HTML and do DOM manipulation in directives.
  • make Controllers as "thin" as possible.

Using Controllers Correctly

@shawndumas
shawndumas / .gitconfig
Created August 5, 2013 19:08
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@cherifGsoul
cherifGsoul / TBCANJS
Created September 12, 2013 14:59
Twitter Bootstrap tabs with canjs Control and Routing
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
</head>
<body>
<div class="container">
<ul class="nav nav-tabs" id="myTab">
@gsouf
gsouf / AuthController.php
Last active April 9, 2021 00:25
oAuth with Phalcon and PHPoAuthLib
<?php
namespace Controllers;
use OAuth\Common\Service\AbstractService;
use OAuth\Common\Storage\Session as OAuthSession;
class AuthController extends ControllerBase {
// everytime we enter the controller, then we check for login, if yes, then we dont have to access here (except logout)