This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
xrandr --output HDMI1 --scale 2x2 --mode 1920x1080 --fb 3840x2160 --pos 3040x0 --rotate normal --primary | |
xrandr --output eDP1 --scale 1x1 --pos -980x0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
const CognitoSDK = require('amazon-cognito-identity-js-node'); | |
AWS.CognitoIdentityServiceProvider.AuthenticationDetails = CognitoSDK.AuthenticationDetails; | |
AWS.CognitoIdentityServiceProvider.CognitoUserPool = CognitoSDK.CognitoUserPool; | |
AWS.CognitoIdentityServiceProvider.CognitoUser = CognitoSDK.CognitoUser; | |
const Username = 'testuser'; | |
const TempPassword = 'TemporaryPassword2!'; | |
const NewPassword = 'NewPassword@#@!19'; | |
const Email = 'some@email.com'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "jekyll-import"; | |
JekyllImport::Importers::WordPress.run({ | |
"dbname" => "db_name", | |
"user" => "user", | |
"password" => "", | |
"host" => "localhost", | |
"socket" => "", | |
"table_prefix" => "wp_", | |
"site_prefix" => "", | |
"clean_entities" => false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'text_2_moretext'.replace( /(text_)(\d+)(_moretext)/, function( $0, $1, $2, $3 ) { | |
return $1 + String( parseInt( $2 ) + 1 ) + $3; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.toTitleCase = function() { | |
return this.replace(/\b\w+/g, function( str ) { | |
return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase(); | |
}); | |
jQuery(document).ready(function(){ | |
jQuery( SELECTOR ).text( function( i, text ) { return text.toTitleCase() } ); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in *.png; do | |
convert ./"$f" -colorspace Gray ./"${f%.png}_gray.png" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Problem is, if I had a unique field, and I'd get an error when trying to save a new object that was conflicting with it, | |
#I wanted the object to load automatically in case it already exists | |
#So I wrote a custom save function (which returns the ID in case the object already exists) | |
def save(self, *args, **kwargs): | |
try: | |
super(Place, self).save(*args, **kwargs) | |
except IntegrityError, e: | |
existing_object = Place.objects.get(slug=self.slug) | |
self = existing_object #this doesn't really work for some reason.. | |
super(Place, self).save(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
def replace_all(text, dic): | |
for replace_with, replace_what in dic.iteritems(): | |
if type(replace_what) is list: | |
for letter in replace_what: | |
text = text.replace(letter,replace_with) | |
else: | |
text = text.replace(replace_what, replace_with) | |
return text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function get_name_by_relation_field($field) { | |
$relations = $this->relations(); | |
$obj_name = NULL; | |
foreach($relations as $relation) { | |
if (isset($relation[2]) && $relation[2] == $field) { | |
$obj_name = isset($relation[1])?$relation[1]:NULL; | |
break; | |
} | |
} | |
return $obj_name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style type="text/css"> | |
label { | |
display:inline-block; | |
vertical-align:top; /* if you have a big text area, this would make the label stay at the top */ | |
width:120px; | |
} | |
input,textarea { | |
display:inline-block; |