Skip to content

Instantly share code, notes, and snippets.

View heralight's full-sized avatar

Alexandre Richonnier heralight

View GitHub Profile
Complete installation process:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y python-software-properties python make build-essential g++ curl libssl-dev apache2-utils git libxml2-dev mercurial
sudo apt-get update
sudo apt-get upgrade
cd ~
mkdir git
cd ~/git
@heralight
heralight / SingleStringTypedField.scala
Created November 7, 2012 10:41
implementation case class instead of enumeration in lift Mongodb Record : SingleStringTypedField
/*
* Copyright 2012 Heirko
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
@heralight
heralight / upload-img.html
Created January 23, 2013 08:59
jquery.fileupload completed callback and add image as list with template.
$('#fileupload').fileupload('option', {
.........
/* on upload complete event*/
completed:function(e, responseJSON){
var files = getFilesFromResponse(responseJSON);
var file = files[0] ||
{error: 'Empty file upload result'};
if (!file.error) {
var data = {};
@heralight
heralight / gist:5196339
Created March 19, 2013 14:02
add permission on all files with lift like for an admin part
package code.lib
import net.liftweb.common._
import net.liftweb.http._
import S._
import net.liftweb.util._
import Helpers._
import code.model.User
package demo.js
import net.liftweb.http.js.JsCmd
object JsCommands30 {
/**
* JsSchedule the execution of the JsCmd using setTimeout()
* @param what the code to execute
*/
@heralight
heralight / UpgradeLiftv2Tov3Tips.md
Last active December 10, 2016 13:33
Tips to Upgrade a liftweb application from 2.5 2.6 to version 3

Some tips to upgrade your lift 2.5 2.6 application to lift 3 (3.0-SNAPSHOT, 3.0-M2, ...etc)

MongoDb

replace ensureIndex( by createIndex( replace setIsUnset( by setIfUnset(

New Features

@heralight
heralight / fix-firefox-fout-font-awesome.html
Last active May 2, 2017 12:22
Fix font-awesome firefox FOUT
<script type="text/javascript">
WebFontConfig = {
custom: { families: [ 'FontAwesome' ],
urls: [ '//cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css'] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
@heralight
heralight / WebSpec2.scala
Created March 29, 2012 08:43
lift:WebSpec2 + Unit test
package code.mockweb
/*
* Copyright 2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@heralight
heralight / bootstrap.sh
Created October 27, 2017 15:58 — forked from keo/bootstrap.sh
Setup encrypted partition for Docker containers
#!/bin/sh
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
CRYPTFS_ROOT=/cryptfs
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup
@heralight
heralight / Remove all git tags
Last active November 11, 2017 16:31 — forked from okunishinishi/Remove all git tags
Delete all git remote tags
# Delete local tags.
git tag -d $(git tag -l)
#Fetch remote tags.
git fetch
#Delete remote tags.
git push origin --delete $(git tag -l) # Pushing once should be faster than multiple times
#Delete local tags.
git tag -d $(git tag -l)
# for shell copy paste: