Skip to content

Instantly share code, notes, and snippets.

View SeriousM's full-sized avatar
🌟
Focusing

Bernhard Millauer SeriousM

🌟
Focusing
View GitHub Profile
@SeriousM
SeriousM / youtube_daily_tracks.cs
Created December 17, 2012 13:45
Get YouTube Daily Top Tracks Playlists
List<Task> tasks = new List<Task>();
for (int i = 1; i <= 1000; i++) {
var reqT = new HttpClient().GetAsync("http://www.youtube.com/playlist?list=MCUS.." + i);
reqT.ContinueWith(t => {
var req = t.Result;
if (req.IsSuccessStatusCode) {
var title = Regex.Match(req.Content.ReadAsStringAsync().Result, "(<title>).*(</title>)").ToString().Replace("<title>", string.Empty).Replace("</title>", string.Empty);
@SeriousM
SeriousM / NOTES.md
Last active December 16, 2015 00:08
This script is able to push the source from one repository/branch to another repository/branch.

Windows

On windows you can specify file repositories with file:///\\<computer>\<path> (ex: file:///\\homepc\repos\git-backup.git).

It is always a good practice to postfix the folder with .git to indicate that this folder is a bare repository.

#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
//==============================================================================
// Casper generated Mon Jun 10 2013 09:27:47 GMT+0200 (W. Europe Daylight Time)
//==============================================================================
var x = require('casper').selectXPath;
var casper = require('casper').create();
casper.options.viewportSize = {width: 1920, height: 1137};
casper.start('http://wetter.orf.at/oes/');
casper.waitForSelector("undefined",
function success() {
@SeriousM
SeriousM / readme.md
Created July 7, 2013 19:18
Gem development

loading gem git clone <git repo>

install local gem (this will load the local one instead the official one) gem install <gem name>

release new version rake release

@SeriousM
SeriousM / GOURCE.md
Last active July 30, 2020 13:17
GOURCE Fast-Forward animation without delete entries

Download: https://github.com/acaudwell/Gource

set G=C:\Users\BernhardMillauer\OWN\Tools\Gource\gource.exe
set D=C:\dev\Everything
%G% --output-custom-log - --path %D%

--> remove |D| lines # | grep -v '|D|'

%G% --path .\gource-out.txt --log-format custom --max-files 0 --file-idle-time 0 --time-scale 2 --seconds-per-day 1 --max-file-lag 1 --auto-skip-seconds 1 --bloom-intensity 1 --bloom-multiplier 1 --hide date,filenames,usernames --elasticity 0.4 --stop-at-end --disable-auto-rotate -1920x1080 -o .\everythinggit.ppm
@SeriousM
SeriousM / 0_reuse_code.js
Created February 10, 2014 11:50
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@SeriousM
SeriousM / gist:9178584
Created February 23, 2014 23:00
Brackets Auto-Complete Error
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
var s;
function create() {
game.physics.setBoundsToWorld(true, true, true, false);
s = game.add.tileSprite(0, 0, 800, 600, 'starfield');
// Author: Darren Schnare, modified by Bernhard Millauer
// Keywords: javascript,interpolation,string,ruby
// License: MIT ( http://www.opensource.org/licenses/mit-license.php )
// Repo: https://gist.github.com/SeriousM/908ee1e67c79681e8c52
String.prototype.interpolate = function (o) {
if (!o) return this;
function getValue(str, context) {
var ix = str.lastIndexOf('()');
if (ix > 0 && ix + '()'.length == str.length){
return context[str.substring(0, ix)]();
@SeriousM
SeriousM / example.html
Last active August 29, 2015 14:01
get executing script tag
<script>
/* another block */
</script>
<script data-test-value="xyz">
//http://stackoverflow.com/a/2954896
// this works because the processing of script blocks is serial
// and others does not exist in that moment of execution.
// works with script-references
// does NOT work with async's
var toArray =Array.prototype.slice;